Kubeadm k8s – 1.18.18 installation

Resources to prepare

role The host name ip system
node k8s-node3 192.168.219.164 CentOS 7.9.2009

Initialize the resource

Reference: https://segmentfault.com/a/11…

Add Node node

1. Create new token on master

[root@k8s-master1 ~]# kubeadm token create --print-join-command --ttl=0

— TTL =0 means that the time will never expire. Without this parameter, the default time expires in 24 hours

The output is as follows:

W0611 03:08:31.246969 63170 ConfigSet. go:202] Warning: Warning: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] kubeadm join 192.168.219.161:6443 - token hkpvr9. Bsfj9a6i7612vd59 -- -- the discovery - the token - ca - cert - hash sha256:a8d537ee5d1a17e73ba94996744ccefd0d2f58f3871f29708e9c5642a28157b7

2. Add Node node

Node operation:

[root@k8s-node3 ~]# kubeadm join 192.168.219.161:6443 --token hkpvr9.bsfj9a6i7612vd59     --discovery-token-ca-cert-hash sha256:a8d537ee5d1a17e73ba94996744ccefd0d2f58f3871f29708e9c5642a28157b7

The output is as follows:

W0611 03:11:48.274867 3087 JOIN.GO :346] [PREFLIGHT] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set. [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] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading Configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Starting the kubelet [kubelet-start] Waiting for  the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

Kubernetes node join container [ERROR fileContent –proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1

Solution:

[root@k8s-node3 ~]# sysctl -w net.ipv4.ip_forward=1

3, validation,

Executes on the master node

[root@k8s-master1 ~]# kubectl get node

The output is as follows:

Name STATUS ROLES AGE VERSION K8S-MASTER1 Ready master 28H v1.18.18K8S-NODE1 Ready < NONE > 28H v1.18.18K8S-NODE2 Ready <none> 28h v1.18.18k8s-node3 Ready <none> 27m v1.18.18