Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docker_advanced_k8s_intro [2020/04/21 09:39] – andonovj | docker_advanced_k8s_intro [2020/05/30 15:17] (current) – [Overview] andonovj | ||
---|---|---|---|
Line 14: | Line 14: | ||
* CNI - Install support for CNI network (Container network Interface / Spec or Model for Kubernetes Network) | * CNI - Install support for CNI network (Container network Interface / Spec or Model for Kubernetes Network) | ||
- | =====Installation===== | + | Furhtermore, |
+ | |||
+ | * Pods | ||
+ | * Replication Controllers / Replication Sets (When Deployment) | ||
+ | * ClusterIP | ||
+ | =====Package | ||
To install the packages we have to: | To install the packages we have to: | ||
Line 92: | Line 97: | ||
< | < | ||
- | root@k8s-master: | + | root@k8s-master: |
Reading package lists... Done | Reading package lists... Done | ||
Building dependency tree | Building dependency tree | ||
Line 108: | Line 113: | ||
Get:1 http:// | Get:1 http:// | ||
Get:2 http:// | Get:2 http:// | ||
- | Get:3 http:// | + | ************************************************************************************************************** |
- | Get:4 http:// | + | |
- | Get:5 http:// | + | |
- | Get:8 http:// | + | |
- | Get:6 https:// | + | |
- | Get:12 http:// | + | |
- | Get:7 https:// | + | |
- | Get:9 https:// | + | |
- | Get:13 http:// | + | |
- | Get:14 http:// | + | |
- | Get:15 http:// | + | |
- | Get:10 https:// | + | |
- | Get:11 https:// | + | |
- | Fetched 104 MB in 6s (15.3 MB/s) | + | |
- | Preconfiguring packages ... | + | |
- | Selecting previously unselected package pigz. | + | |
- | (Reading database ... 58264 files and directories currently installed.) | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking pigz (2.3.1-2) ... | + | |
- | Selecting previously unselected package bridge-utils. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking bridge-utils (1.5-9ubuntu1) ... | + | |
- | Selecting previously unselected package cgroupfs-mount. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking cgroupfs-mount (1.2) ... | + | |
- | Selecting previously unselected package conntrack. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking conntrack (1:1.4.3-3) ... | + | |
- | Selecting previously unselected package runc. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking runc (1.0.0~rc7+git20190403.029124da-0ubuntu1~16.04.4) ... | + | |
- | Selecting previously unselected package containerd. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking containerd (1.2.6-0ubuntu1~16.04.3) ... | + | |
- | Selecting previously unselected package cri-tools. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking cri-tools (1.13.0-00) ... | + | |
- | Selecting previously unselected package docker.io. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking docker.io (18.09.7-0ubuntu1~16.04.5) ... | + | |
- | Selecting previously unselected package ebtables. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking ebtables (2.0.10.4-3.4ubuntu2.16.04.2) ... | + | |
- | Selecting previously unselected package kubernetes-cni. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking kubernetes-cni (0.7.5-00) ... | + | |
- | Selecting previously unselected package socat. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking socat (1.7.3.1-1) ... | + | |
- | Selecting previously unselected package kubelet. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking kubelet (1.18.2-00) ... | + | |
- | Selecting previously unselected package kubectl. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking kubectl (1.18.2-00) ... | + | |
- | Selecting previously unselected package kubeadm. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking kubeadm (1.18.2-00) ... | + | |
- | Selecting previously unselected package ubuntu-fan. | + | |
- | Preparing to unpack .../ | + | |
- | Unpacking ubuntu-fan (0.12.8~16.04.3) ... | + | |
- | Processing triggers for man-db (2.7.5-1) ... | + | |
- | Processing triggers for ureadahead (0.100.0-19.1) ... | + | |
- | Processing triggers for systemd (229-4ubuntu21.27) ... | + | |
- | Setting up pigz (2.3.1-2) ... | + | |
- | Setting up bridge-utils (1.5-9ubuntu1) ... | + | |
- | Setting up cgroupfs-mount (1.2) ... | + | |
- | Setting up conntrack (1:1.4.3-3) ... | + | |
- | Setting up runc (1.0.0~rc7+git20190403.029124da-0ubuntu1~16.04.4) ... | + | |
- | Setting up containerd (1.2.6-0ubuntu1~16.04.3) ... | + | |
- | Setting up cri-tools (1.13.0-00) ... | + | |
- | Setting up docker.io (18.09.7-0ubuntu1~16.04.5) ... | + | |
- | Adding group `docker' | + | |
- | Done. | + | |
- | Setting up ebtables (2.0.10.4-3.4ubuntu2.16.04.2) ... | + | |
- | update-rc.d: | + | |
- | Setting up kubernetes-cni (0.7.5-00) ... | + | |
- | Setting up socat (1.7.3.1-1) ... | + | |
- | Setting up kubelet (1.18.2-00) ... | + | |
- | Setting up kubectl (1.18.2-00) ... | + | |
- | Setting up kubeadm (1.18.2-00) ... | + | |
- | Setting up ubuntu-fan (0.12.8~16.04.3) ... | + | |
- | Processing triggers for ureadahead (0.100.0-19.1) ... | + | |
- | Processing triggers for systemd (229-4ubuntu21.27) ... | + | |
</ | </ | ||
Please execute that on all 3 machines | Please execute that on all 3 machines | ||
- | ====Initiliaze the cluster==== | ||
- | To initialize the cluster, we have to take two factors into consideration: | ||
- | |||
- | - Which will be the advertise IP ? | ||
- | - Which will be the network which we will use for the pods. | ||
- | |||
- | The first question is pretty easy. Just use the network which is assigned to your master. In our case, we have 1 master and 2 noides. | ||
- | So we will assign the advertise IP of the master: | ||
- | |||
- | * master - 192.168.50.10 | ||
- | * node1 - 192.168.50.11 | ||
- | * node2 - 192.168.50.12 | ||
- | |||
- | The second question however, depends on the network which will be used for the pods. In our example I have used calico, because of the reasons listed below.Thus, our pod network by default is: 192.168.0.0/ | ||
- | |||
- | So let's see how our commands | ||
- | |||
- | < | ||
- | root@k8s-master: | ||
- | W0421 09: | ||
- | [init] Using Kubernetes version: v1.18.2 | ||
- | [preflight] Running pre-flight checks | ||
- | [WARNING IsDockerSystemdCheck]: | ||
- | [preflight] Pulling images required for setting up a Kubernetes cluster | ||
- | [preflight] This might take a minute or two, depending on the speed of your internet connection | ||
- | [preflight] You can also perform this action in beforehand using ' | ||
- | ************************************************************************************************************************** | ||
- | [kubelet-finalize] Updating "/ | ||
- | [addons] Applied essential addon: CoreDNS | ||
- | [addons] Applied essential addon: kube-proxy | ||
- | |||
- | Your Kubernetes control-plane has initialized successfully! | ||
- | |||
- | To start using your cluster, you need to run the following as a regular user: | ||
- | |||
- | 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:// | ||
- | |||
- | Then you can join any number of worker nodes by running the following on each as root: | ||
- | |||
- | kubeadm join 192.168.50.10: | ||
- | --discovery-token-ca-cert-hash sha256: | ||
- | root@k8s-master: | ||
- | </ | ||
- | |||
- | After that, we have to perform a couple commands from the user, which will be responsible for the kubernetes and won't be root. (P.S. usage of root for applications is STRONGLY DISCOURAGED because of security stuff :) ) | ||
- | |||
- | So just transfer it using the instructions above: | ||
- | |||
- | < | ||
- | mkdir -p $HOME/.kube | ||
- | sudo cp -i / | ||
- | sudo chown $(id -u):$(id -g) $HOME/ | ||
- | </ | ||
- | |||
- | Once we have done that, we can check the cluster: | ||
- | |||
- | < | ||
- | ubuntu@k8s-master: | ||
- | NAME | ||
- | k8s-master | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ====Configure the network==== | ||
- | Now, when you install | ||
- | If you have higher version than 1.16, you cannot use weave network anymore. In our example I have used calico 3.8. | ||