Copy [vagrant@kk8s-1 ~ ]$ sudo vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
Environment = "KUBELET_CGROUP_ARGS=--cgroup-driver=systemd"
ExecStart = /usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS $KUBELET_CGROUP_ARGS
錯誤1:IPVS proxier will not be used
Copy [WARNING RequiredIPVSKernelModulesAvailable]:
the IPVS proxier will not be used, because the following required kernel modules are not loaded:
[ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh] or no builtin kernel ipvs support:
map[ip_vs: {} ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{}]
you can solve this problem with following methods:
1. Run 'modprobe -- ' to load missing kernel modules ;
2. Provide the missing builtin kernel ipvs support
Copy sudo modprobe ip_vs_rr
sudo modprobe ip_vs_wrr
sudo modprobe ip_vs_sh
sudo modprobe ip_vs
sudo modprobe nf_conntrack_ipv4
# 檢查:
sudo lsmod | grep ip_vs
Copy [preflight] Some fatal errors occurred:
[ERROR FileAvailable--etc-kubernetes-kubelet.conf] : /etc/kubernetes/kubelet.conf already exists
[ERROR FileAvailable--etc-kubernetes-bootstrap-kubelet.conf] : /etc/kubernetes/bootstrap-kubelet.conf already exists
[ERROR FileAvailable--etc-kubernetes-pki-ca.crt] : /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors = ... `
Copy sudo kubeadm join 192.168.42.191:6443 --token noduzf.t2ng9nhcx2gdo53y \
--discovery-token-ca-cert-hash sha256:d02f588e50c1f16fb9eec512e5ca14fd2add98e0231805a46c4e0fb2aff83555 \
--cri-socket= "/var/run/crio/crio.sock" \
--ignore-preflight-errors=all
# 成功完成 join
錯誤3:connection to the server localhost:8080 was refused
Copy [vagrant@kk8s-2 ~ ]$ kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Copy mkdir -p $HOME /.kube
scp master-ip: $HOME /.kube/config $HOME /.kube/config
sudo chown $( id -u ) : $( id -g ) $HOME /.kube/config
[vagrant@kk8s-2 ~ ]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
kk8s-1 Ready master 23h v1.12.2
kk8s-2 Ready < non e > 24m v1.12.2
kk8s-3 Ready < non e > 17m v1.12.2