Skip to content

Commit

Permalink
Updated installation steps (#472)
Browse files Browse the repository at this point in the history
* Updated setup script to reduce steps in guidelines

* Updated installation steps

* Modified installation

* added KUBECTL_LOG environment variable required in mizar
  • Loading branch information
click2cloud-amit authored May 19, 2021
1 parent 8163906 commit 4ec13d3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 87 deletions.
85 changes: 19 additions & 66 deletions docs/guide/arktos_mizar_installation_single.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For more details on Arktos installation, please refer to [this link](https://git

```bash
cd
git clone https://github.com/centaurus-cloud/mizar.git
git clone https://github.com/CentaurusInfra/mizar.git
cd mizar
chmod 755 setup-machine-arktos.sh
./setup-machine-arktos.sh
Expand All @@ -44,6 +44,7 @@ The lab machine will be rebooted once above script is completed, you will be aut

2. Log onto your lab machine, then run ```bootstrap.sh``` script from the mizar project folder to bootstrap your lab machine.


3. Once bootstrap is completed, you can then compile mizar. Make sure run these in ```sudo``` mode:

```bash
Expand All @@ -52,52 +53,24 @@ sudo su
make
```

4. Modify your lab machine's network configurations:

please ensure the hostname and its ip address in ```/etc/hosts```. For instance, if the hostname is ip-172-31-41-177, ip address is 172.31.41.177:
```text
127.0.0.1 localhost
172.31.41.177 ip-172-31-41-177
```

5. Build arktos-network-controller (as it is not part of arktos-up.sh yet)
4. Build arktos-network-controller (as it is not part of arktos-up.sh yet)

```bash
cd $HOME/go/src/k8s.io/arktos
sudo ./hack/setup-dev-node.sh
make all WHAT=cmd/arktos-network-controller
sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
```

6. Update containerd version to v1.4.2

```bash
cd $HOME
wget https://github.com/containerd/containerd/releases/download/v1.4.2/containerd-1.4.2-linux-amd64.tar.gz
cd /usr
sudo tar xvf $HOME/containerd-1.4.2-linux-amd64.tar.gz
```

To confirm if containerd version is successfully updated, run:

```bash
❯ containerd --version
containerd github.com/containerd/containerd v1.4.2 b321d358e6eef9c82fa3f3bb8826dca3724c58c6
Also, please ensure the hostname and its ip address in /etc/hosts. For instance, if the hostname is ip-172-31-41-177, ip address is 172.31.41.177:
```text
127.0.0.1 localhost
172.31.41.177 ip-172-31-41-177
```

7. Replace the Artos containerd:
5. Replace the Arktos containerd:

```bash
cd $HOME/go/src/k8s.io/arktos
wget -qO- https://github.com/futurewei-cloud/containerd/releases/download/tenant-cni-args/containerd.zip | zcat > /tmp/containerd
sudo chmod +x /tmp/containerd
sudo systemctl stop containerd
sudo mv /usr/bin/containerd /usr/bin/containerd.bak
sudo mv /tmp/containerd /usr/bin/
sudo systemctl restart containerd
sudo systemctl start docker
export CONTAINER_RUNTIME_ENDPOINT="containerRuntime,container,/run/containerd/containerd.sock"
cd $HOME/mizar
./replace-containerd.sh
```

To make sure containerd is running as expected, run:
Expand All @@ -106,7 +79,7 @@ To make sure containerd is running as expected, run:
sudo systemctl status containerd.service
```

8. Before deploying Mizar, you will need first start up Arktos API server:
6. Before deploying Mizar, you will need first start up Arktos API server:

```bash
cd $HOME/go/src/k8s.io/arktos
Expand Down Expand Up @@ -135,7 +108,13 @@ Alternatively, you can write to the default kubeconfig:
cluster/kubectl.sh
```

9. Once you see above text, your arktos server is now running.
7. Deploy Mizar. Open a new terminal window, and run:
```bash
cd $HOME/mizar
./deploy-mizar.sh
```

8. Once your arktos server and mizar are running.
To verify, you can open a new terminal and run ```kubectl get nodes```, you should see a node running with the name starts with "ip" followed by the private ip address of your lab machine.

You also want make sure the default kubernetes bridge network configuration file is deleted:
Expand All @@ -145,42 +124,16 @@ sudo ls /etc/cni/net.d
sudo rm /etc/cni/net.d/bridge.conf
```

10. Start Arktos network controller. From a new terminal window, run:
9. Start Arktos network controller. From a new terminal window, run:

```bash
cd $HOME/go/src/k8s.io/arktos
./_output/local/bin/linux/amd64/arktos-network-controller --kubeconfig=/var/run/kubernetes/admin.kubeconfig --kube-apiserver-ip=xxx.xxx.xxx.xxx
```
where the ```kube-apiserver-ip``` is your lab machine's **private ip address**

11. Set Arktos and Mizar alias:

```bash
alias kubectl='$HOME/go/src/k8s.io/arktos/cluster/kubectl.sh'
alias kubeop="kubectl get pods | grep mizar-operator | awk '{print \$1}' | xargs -i kubectl logs {}"
alias kubed="kubectl get pods | grep mizar-daemon | awk '{print \$1}' | xargs -i kubectl logs {}"
```

12. Deploy Mizar. Open a new terminal window, and run:
```bash
cd $HOME/mizar
./deploy-mizar.sh
```

Please refer to [Running Mizar Management Plane](https://mizar.readthedocs.io/en/latest/user/getting_started/#running-mizar-management-plane) for how to inspect resources.

13. Restart containerd

```bash
sudo systemctl restart containerd.service
```

To make sure containerd is running as expected, run:

```bash
sudo systemctl status containerd.service
```

## Test

To test your environment, you can first create an arktos network object ```my-net-mizar-1```. Then create a pod in ```my-net-mizar-1```:
Expand Down
10 changes: 10 additions & 0 deletions replace-containerd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

cd $HOME/go/src/k8s.io/arktos
wget -qO- https://github.com/CentaurusInfra/containerd/releases/download/tenant-cni-args/containerd.zip | zcat > /tmp/containerd
sudo chmod +x /tmp/containerd
sudo systemctl stop containerd
sudo mv /usr/bin/containerd /usr/bin/containerd.bak
sudo mv /tmp/containerd /usr/bin/
sudo systemctl restart containerd
sudo systemctl restart docker
45 changes: 24 additions & 21 deletions setup-machine-arktos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@
echo Setup: Install go \(currently limited to version 1.13.9\)

sudo apt-get update -y -q
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y -q
sudo apt-get install build-essential -y -q
sudo apt-get install zlib1g-dev -y -q
sudo apt-get install libreadline-gplv2-dev -y -q
sudo apt-get install libncursesw5-dev -y -q
sudo apt-get install libssl-dev -y -q
sudo apt-get install libnss3-dev -y -q
sudo apt-get install libsqlite3-dev -y -q
sudo apt-get install tk-dev -y -q
sudo apt-get install libgdbm-dev -y -q
sudo apt-get install libc6-dev -y -q
sudo apt-get install libbz2-dev -y -q
sudo apt-get install libreadline-dev -y -q
sudo apt-get install libffi-dev -y -q

cd /tmp
wget https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz
Expand Down Expand Up @@ -55,8 +67,8 @@ echo Setup: Install crictl

cd /tmp
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.17.0/crictl-v1.17.0-linux-amd64.tar.gz
sudo tar zxvf crictl-v1.17.0-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-v1.17.0-linux-amd64.tar.gz
sudo tar -zxvf crictl-v1.17.0-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-v1.17.0-linux-amd64.tar.gz

touch /tmp/crictl.yaml
echo runtime-endpoint: unix:///run/containerd/containerd.sock >> /tmp/crictl.yaml
Expand All @@ -78,23 +90,24 @@ echo Setup: Install miscellaneous
wget -O $HOME/Python-3.8.8.tgz https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz
tar -C $HOME -xzf $HOME/Python-3.8.8.tgz
cd $HOME/Python-3.8.8
sudo ./configure
sudo ./configure --enable-optimizations
sudo make
sudo make install
sudo make altinstall
sudo ln -sfn /usr/local/bin/python3.8 /usr/bin/python3
sudo apt remove -fy python3-apt
sudo apt install -fy python3-apt
sudo apt update
sudo apt install -fy python3-pip
sudo sed -i '1c\#!/usr/bin/python3.8 -Es' /usr/bin/lsb_release
sudo /usr/local/bin/python3.8 -m pip install --upgrade pip -y -q

sudo rm -rf $HOME/Python-3.8.8.tgz
sudo rm -rf $HOME/Python-3.8.8
sudo sed -i '1c\#!/usr/bin/python3.6 -Es' /usr/bin/lsb_release
sudo /usr/local/bin/python3.8 -m pip install --upgrade pip

sudo apt install awscli -y -q
sudo apt install jq -y -q

sudo rm -rf $HOME/Python-3.8.8.tgz
sudo rm -rf $HOME/Python-3.8.8

####################

echo Setup: Mizar Related
Expand All @@ -109,7 +122,6 @@ sudo apt-get install -y \
libcmocka-dev \
lcov

sudo apt install docker.io
sudo pip3 install netaddr docker scapy
sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
Expand Down Expand Up @@ -149,17 +161,7 @@ echo Setup: Install Containerd
cd $HOME
wget https://github.com/containerd/containerd/releases/download/v1.4.2/containerd-1.4.2-linux-amd64.tar.gz
cd /usr
sudo tar xvf $HOME/containerd-1.4.2-linux-amd64.tar.gz

cd $HOME/go/src/k8s.io/arktos
wget -qO- https://github.com/futurewei-cloud/containerd/releases/download/tenant-cni-args/containerd.zip | zcat > /tmp/containerd
sudo chmod +x /tmp/containerd
sudo systemctl stop containerd
sudo mv /usr/bin/containerd /usr/bin/containerd.bak
sudo mv /tmp/containerd /usr/bin/
sudo systemctl restart containerd
sudo systemctl restart docker

sudo tar -xvf $HOME/containerd-1.4.2-linux-amd64.tar.gz
sudo rm -rf $HOME/containerd-1.4.2-linux-amd64.tar.gz

####################
Expand All @@ -183,6 +185,7 @@ echo alias kubeop=\"kubectl get pods \|\ grep mizar-operator \|\ awk \'{print \$
echo alias kubed=\"kubectl get pods \|\ grep mizar-daemon \|\ awk \'{print \$1}\' \|\ xargs -i kubectl logs {}\" >> ~/.profile
echo export CONTAINER_RUNTIME_ENDPOINT=\"\containerRuntime,container,/run/containerd/containerd.sock\" >> ~/.profile
echo export PYTHONPATH=\"\$HOME/mizar/\" >> ~/.profile
echo export KUBECTL_LOG=\"\/tmp/${USER}_kubetctl.err\" >> ~/.profile
echo export GPG_TTY=\$\(tty\) >> ~/.profile

echo cd \$HOME/go/src/k8s.io/arktos >> ~/.profile
Expand Down

0 comments on commit 4ec13d3

Please sign in to comment.