From 4ec13d3f71e6e07b5ae09f3c892f09313dc1f137 Mon Sep 17 00:00:00 2001 From: Amit Nagpure <53761776+click2cloud-amit@users.noreply.github.com> Date: Thu, 20 May 2021 03:06:27 +0530 Subject: [PATCH] Updated installation steps (#472) * Updated setup script to reduce steps in guidelines * Updated installation steps * Modified installation * added KUBECTL_LOG environment variable required in mizar --- .../guide/arktos_mizar_installation_single.md | 85 +++++-------------- replace-containerd.sh | 10 +++ setup-machine-arktos.sh | 45 +++++----- 3 files changed, 53 insertions(+), 87 deletions(-) create mode 100644 replace-containerd.sh diff --git a/docs/guide/arktos_mizar_installation_single.md b/docs/guide/arktos_mizar_installation_single.md index 1c27adba..e26b561b 100644 --- a/docs/guide/arktos_mizar_installation_single.md +++ b/docs/guide/arktos_mizar_installation_single.md @@ -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 @@ -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 @@ -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: @@ -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 @@ -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: @@ -145,7 +124,7 @@ 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 @@ -153,34 +132,8 @@ cd $HOME/go/src/k8s.io/arktos ``` 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```: diff --git a/replace-containerd.sh b/replace-containerd.sh new file mode 100644 index 00000000..8a151ed1 --- /dev/null +++ b/replace-containerd.sh @@ -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 diff --git a/setup-machine-arktos.sh b/setup-machine-arktos.sh index 2f5112be..618bf2d3 100644 --- a/setup-machine-arktos.sh +++ b/setup-machine-arktos.sh @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 #################### @@ -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