cni is an interface k8s, if necessary docking k8s need to follow cni interface standard, mainly for deployment cni turned a third-party network;
For third-party plug-ins to achieve network
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
About cni installation planning and flanel
- cni installed on each node to node
- flannel mounted to the master node
node node installation cni
cni binary package Download:
https://github.com/containernetworking/plugins/releases
First, download the installation package cni
Second, extract the installation package cni
mkdir -p / opt / cni / bin # working directory
mkdir -p /etc/cni/net.d # Profiles
tar -zxvf
cni-plugins-linux-amd64-v0.8.5.tgz -C /opt/cni/bin
master node installation flannel
Third, we installed flannel
flannel installation tutorial
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
note:
- The flannel only need to install the master node
- This file needs over the wall, executed directly downloaded to the server after kubectl apply -f kube-flannel.yml (inside the mirror needs over the wall, foreign direct installation will fail, not recommended)
- yaml inside the network and for net-conf.json cat /opt/kubernetes/cfg/kube-controller-manager.conf inside the cluster-cidr values agree
- If you do not use flannel, other components, too
Fourth, the implementation ymal
kubectl apply -f kube-flannel.yml
V. After installation view
kubectl get pods -n kube-system
The following output
NAME READY STATUS RESTARTS AGE
kube-flannel-ds-amd64-q8rmk 1/1 Running 0 19m
kube-flannel-ds-amd64-zq7hc 1/1 Running 0 19m
kube-flannel-ds-amd64-q8rmk 1/1 Running 0 19m
kube-flannel-ds-amd64-zq7hc 1/1 Running 0 19m
1/1 represents a successful start, 0/1 indicates failed to start
VI View pod
After installation, each node will start a pod
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-flannel-ds-amd64-q8rmk 1/1 Running 0 18m 172.19.216.179 k8s-node1 <none> <none>
kube-flannel-ds-amd64-zq7hc 1/1 Running 0 18m 172.19.216.180 k8s-node2 <none> <none>
kube-flannel-ds-amd64-q8rmk 1/1 Running 0 18m 172.19.216.179 k8s-node1 <none> <none>
kube-flannel-ds-amd64-zq7hc 1/1 Running 0 18m 172.19.216.180 k8s-node2 <none> <none>
Seven, we look flannel card in each node node
We will see through ifconfig node has a flannel card