Changes between Initial Version and Version 1 of Tutorials/m0SDN/k8s


Ignore:
Timestamp:
Jul 12, 2023, 6:59:17 PM (17 months ago)
Author:
jlaxman
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/m0SDN/k8s

    v1 v1  
     1Kubernetes Wiki Doc:
     2[[TOC(Documentation/f*, depth=3)]]
     3
     4== Tutorial: Kubernetes Setup==
     5Requirements:
     6
     71. [https://www.orbit-lab.org/wiki/Documentation/CGettingStarted Setup/Practice] of Orbit Nodes.
     8
     92. Any available Orbit Sandbox Node
     10
     113. Ubuntu 20.04.5 LTS or Ubuntu 22.04.2 LTS (Choice is up to you)
     12
     13----
     14
     15In this tutorial, we will be using one of the sb1 nodes for setting up Kubernetes. However, sb(1-10) should also be capable for Kubernetes setup.
     16
     17Make sure you have Ubuntu 20.04.5 (**baseline20.04.ndz**) or 22.04.2 (**ubuntu2204-beta.ndz**) LTS. To get the Ubuntu Version, follow these steps after ssh'ing into your console. Substitute for the image and node you want.
     18
     19The below steps illustrate loading Ubuntu 20.04.5 LTS for node1-2 of sb1. For the sb1 console,
     20
     21{{{#!shell
     22username@console:~$ omf tell -t node1-2 -a offh
     23}}}
     24
     25{{{#!shell
     26username@console:~$ omf load -t node1-2 -i baseline20.04.ndz
     27}}}
     28
     29{{{#!shell
     30username@console:~$ omf tell -t node1-2 -a on
     31}}}
     32
     33To verify if you have loaded your Ubuntu version properly, use this command after ssh into the node1-2
     34
     35{{{#!shell
     36root@node1-2:~# lsb_release -a
     37}}}
     38
     39This will list the current version of Ubuntu loaded.
     40
     41Example Image:
     42
     43[[Image(lsb_release.jpg)]]
     44
     45=== Set up a Kubernetes Cluster ===
     46After loading your version of Ubuntu, you can follow the below steps to install Kubernetes
     47
     481. Update and Upgrade Packages:
     49{{{#!shell
     50root@node1-2:~# sudo apt-get update && sudo apt-get upgrade
     51}}}
     52
     532. Install Docker:
     54{{{#!shell
     55root@node1-2:~# sudo apt install docker.io
     56}}}
     57
     583. Configure Docker to use systemd for the management of the container’s cgroups:
     59{{{#!shell
     60root@node1-2:~# cat <<EOF | sudo tee /etc/docker/daemon.json
     61{
     62  "exec-opts": ["native.cgroupdriver=systemd"],
     63  "log-driver": "json-file",
     64  "log-opts": {
     65    "max-size": "100m"
     66  },
     67  "storage-driver": "overlay2"
     68}
     69EOF
     70}}}
     71
     724. Enable Docker:
     73{{{#!shell
     74root@node1-2:~# sudo systemctl enable docker
     75}}}
     76
     775. Reload the systemd manager configuration:
     78{{{#!shell
     79root@node1-2:~# sudo systemctl daemon-reload
     80}}}
     81
     826. Restart Docker:
     83{{{#!shell
     84root@node1-2:~# sudo systemctl restart docker
     85}}}
     86
     877. Update and Upgrade Packages again:
     88{{{#!shell
     89root@node1-2:~# apt update && apt upgrade -y
     90}}}
     91
     928. Add Kubernetes to the repository list:
     93{{{#!shell
     94root@node1-2:~# curl -sSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/kubernetes-archive-keyring.gpg >/dev/null
     95}}}
     96{{{#!shell
     97root@node1-2:~# echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
     98}}}
     99
     1009. Install Kubernetes:
     101{{{#!shell
     102root@node1-2:~# sudo apt-get update
     103}}}
     104{{{#!shell
     105root@node1-2:~# sudo apt-get install -y kubelet kubeadm kubectl
     106}}}
     107{{{#!shell
     108root@node1-2:~# sudo apt-mark hold kubelet kubeadm kubectl
     109}}}
     110
     11110. Initialize the Kubernetes Cluster:
     112{{{#!shell
     113root@node1-2:~# kubeadm init --pod-network-cidr=10.19.0.0/16
     114}}}
     115
     116You should see an output which includes a `kubeadm join` command, save this command for use on the worker nodes.
     117
     11811. Set KUBECONFIG environment variable:
     119{{{#!shell
     120root@node1-2:~# export KUBECONFIG=/etc/kubernetes/admin.conf
     121}}}
     122
     12312. Apply Flannel network overlay:
     124{{{#!shell
     125root@node1-2:~# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
     126}}}
     127
     128=== Joining Worker Nodes to the Cluster ===
     129To join worker nodes to the Kubernetes cluster, run the `kubeadm join` command that was outputted by the `kubeadm init` command.
     130
     131Example:
     132{{{#!shell
     133root@node1-2:~# kubeadm join 10.19.1.5:6443 --token o1cttx.z9al8w8ljqcmqb4y --discovery-token-ca-cert-hash sha256:6ecd74d7eca0299b80499cf2e2e1c87c4079c3d234282be5822761880998853e
     134}}}
     135
     136= Hope You Figure Out the Purpose of Kubernetes =