Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_advanced_k8s_intro [2020/04/21 09:39] andonovjdocker_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, Kubernetes have various objects, but let's examine the main ones: 
 + 
 +  * Pods 
 +  * Replication Controllers / Replication Sets (When Deployment) 
 +  * ClusterIP 
 +=====Package Installation=====
 To install the packages we have to: To install the packages we have to:
  
Line 92: Line 97:
  
 <Code:shell|Install packages> <Code:shell|Install packages>
-root@k8s-master:~# apt-get install docker.io kubeadm kubectl kubelet kubernetes-cni+root@k8s-master:~# apt-get install -y docker.io kubeadm kubectl kubelet kubernetes-cni
 Reading package lists... Done Reading package lists... Done
 Building dependency tree Building dependency tree
Line 112: Line 117:
  
 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/16. 
- 
-So let's see how our commands 
- 
-<Code:none|Initialize the cluster> 
-root@k8s-master:~# kubeadm init --ignore-preflight-errors=NumCPU --apiserver-advertise-address=192.168.50.10 --pod-network-cidr=192.168.0.0/16 
-W0421 09:20:50.597038   21388 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] 
-[init] Using Kubernetes version: v1.18.2 
-[preflight] Running pre-flight checks 
-        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ 
-[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 'kubeadm config images pull' 
-************************************************************************************************************************** 
-[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key 
-[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 /etc/kubernetes/admin.conf $HOME/.kube/config 
-  sudo chown $(id -u):$(id -g) $HOME/.kube/config 
- 
-You should now deploy a pod network to the cluster. 
-Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: 
-  https://kubernetes.io/docs/concepts/cluster-administration/addons/ 
- 
-Then you can join any number of worker nodes by running the following on each as root: 
- 
-kubeadm join 192.168.50.10:6443 --token k7cnjt.c0vkn3i6sc9qp2it \ 
-    --discovery-token-ca-cert-hash sha256:8c7874be67b9670c52a729b7a26bdefb4b55f5a49402624c0d262c0253732228 
-root@k8s-master:~# 
-</Code> 
- 
-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: 
- 
-<Code:none|Execute as normal User> 
-mkdir -p $HOME/.kube 
-sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 
-sudo chown $(id -u):$(id -g) $HOME/.kube/config 
-</Code> 
- 
-Once we have done that, we can check the cluster: 
- 
-<Code:shell|Check the cluster> 
-ubuntu@k8s-master:~$ kubectl get nodes 
-NAME         STATUS     ROLES    AGE   VERSION 
-k8s-master   NotReady   master   62s   v1.18.2 
-</Code> 
- 
- 
- 
-====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. 
  
  
  • docker_advanced_k8s_intro.1587461971.txt.gz
  • Last modified: 2020/04/21 09:39
  • by andonovj