1

Every node shows this error while I tried to join those nodes with Kubernetes master. Any suggestion?

[root@kube-node1 ~]#  kubeadm join 10.0.0.50:6443 --token xtalee.aftgxumqvtjtcq56 --discovery-token-ca-cert-hash sha256:d0f97b9d53be798a6ab871a2fd8271ee6461b9fd6fdc6350eb89ebee98629ac6
[preflight] running pre-flight checks
        [WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs_sh ip_vs ip_vs_rr ip_vs_wrr] or no builtin kernel ipvs support: map[ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{} ip_vs:{}]
you can solve this problem with following methods:
 1. Run 'modprobe -- ' to load missing kernel modules;
2. Provide the missing builtin kernel ipvs support

[preflight] Some fatal errors occurred:
        [ERROR FileAvailable--etc-kubernetes-bootstrap-kubelet.conf]: /etc/kubernetes/bootstrap-kubelet.conf already exists
        [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1
        [ERROR Swap]: running with swap on is not supported. Please disable swap
        [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=...`
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
hpmistry19
  • 19
  • 1
  • 1
  • 5

4 Answers4

10

If you're getting the following error because you've already executed the join command on your nodes. Its created your /etc/kubernetes/pki/ca.crt file even though your node failed to join.

To get rid of this error, execute the "kubeadm reset" command on your node and execute then join command again. This will reset your cluster environment and then when you try joining the node again to the cluster, it will create all the files again.

user524332
  • 101
  • 1
  • 3
4

This error does occur if you run kubeadm init and then try to join, because kubeadm creates these files. Especially if this is a new cluster master, which you ran kubeadm init.

You may still need to do a kubeadm join, in which case you will encounter this scenario. It is documented as an issue. The K8S documentation notes that you can ignore these errors.

As I noted there, you should add the following to your join command:

--ignore-preflight-errors='DirAvailable--etc-kubernetes-manifests,FileAvailable--etc-kubernetes-kubelet.conf,Port-10250,FileAvailable--etc-kubernetes-pki-ca.crt'

You can see a working example I made, running K8S v1.14.3 here.

As an extra bit, you should disable swap, which will address your 'Error Swap' error (Example here):

dphys-swapfile swapoff && dphys-swapfile uninstall && update-rc.d dphys-swapfile remove

Hope this helps.

Edit: Note that if these are brand new nodes to the cluster, before kubeadm join, to delete any I always run:

kubeadm reset --force

Note: Don't do this ^^ (reset) on your master after you do a kubeadm init. :)

Kareem
  • 159
  • 4
0

The problem is from swap just type this command and rejoin your node

sudo su
swapoff -a
kenlukas
  • 2,886
  • 2
  • 14
  • 25
apollo
  • 1
0

Try to use @kvaps approach posted on github

Vit
  • 445
  • 2
  • 10