Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:dev:env:kubernetes [2019/01/05 18:26] – alexejsailer | en:dev:env:kubernetes [2020/03/05 21:23] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Kubernetes ====== | ====== Kubernetes ====== | ||
+ | |||
+ | This is a smal how-to to setup a kmaster and a knode. | ||
With ubuntu 16.04 | With ubuntu 16.04 | ||
Line 109: | Line 111: | ||
apt-mark hold kubelet kubeadm kubectl | apt-mark hold kubelet kubeadm kubectl | ||
</ | </ | ||
+ | |||
+ | **//From here all operations should be done only on kmaster//** | ||
+ | |||
* check cgroup driver | * check cgroup driver | ||
Line 143: | Line 148: | ||
kubeadm init --apiserver-advertise-address=192.168.56.201 --pod-network-cidr=192.168.0.0/ | kubeadm init --apiserver-advertise-address=192.168.56.201 --pod-network-cidr=192.168.0.0/ | ||
</ | </ | ||
+ | |||
+ | * you should see the following: | ||
+ | |||
+ | <sxh bash;> | ||
+ | |||
+ | mkdir -p $HOME/.kube | ||
+ | sudo cp -i / | ||
+ | sudo chown $(id -u):$(id -g) $HOME/ | ||
+ | |||
+ | You should now deploy a pod network to the cluster. | ||
+ | Run " | ||
+ | https:// | ||
+ | |||
+ | You can now join any number of machines by running the following on each node | ||
+ | as root: | ||
+ | |||
+ | kubeadm join 192.168.56.201: | ||
+ | |||
+ | </ | ||
+ | |||
<sxh bash;> | <sxh bash;> | ||
Line 149: | Line 174: | ||
sudo chown $(id -u):$(id -g) $HOME/ | sudo chown $(id -u):$(id -g) $HOME/ | ||
</ | </ | ||
+ | |||
+ | * install flannel | ||
<sxh bash;> | <sxh bash;> | ||
Line 155: | Line 182: | ||
</ | </ | ||
+ | * check if everything is running | ||
+ | |||
+ | <sxh bash;> | ||
+ | kubectl get pods -o wide --all-namespaces | ||
+ | </ | ||
+ | |||
+ | * should look like | ||
+ | |||
+ | <sxh bash;> | ||
+ | NAMESPACE | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | kube-system | ||
+ | </ | ||
+ | |||
+ | * install the kubernetes dashboard | ||
+ | |||
+ | <sxh bash;> | ||
+ | kubectl apply -f https:// | ||
+ | # get token to login to dashboard | ||
+ | kubectl create serviceaccount dashboard -n default | ||
+ | kubectl create clusterrolebinding dashboard-admin -n default --clusterrole=cluster-admin --serviceaccount=default: | ||
+ | kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath=" | ||
+ | </ | ||
+ | |||
+ | * start dashboard | ||
+ | |||
+ | <sxh bash;> | ||
+ | kubectl proxy | ||
+ | </ | ||
+ | |||
+ | * now you can reach the dashbard at | ||
+ | |||
+ | http:// | ||
+ | |||
+ | * to reach it from the host os you can tunnel the port 8001 from kmaster to your host | ||
+ | |||
+ | So now the kmaster is running. For the knode you have to repeate all operations above until the bold message which says: **From here all operations should be done only on kmaster**. Just set a diffrent host **knode** and a new static IP **192.168.56.202** | ||
+ | |||
+ | After all operations were executed successfully do the connection. To join type in the above join statement. This is exactly what you got as message after starting kubernetes on master:** Refere to the output above, it is the same!** | ||
+ | |||
+ | <sxh bash;> | ||
+ | sudo kubeadm join 192.168.56.201: | ||
+ | </ | ||
+ | Sources: | ||
+ | https:// | ||