kairen / kubeadm-ansible

Build a Kubernetes cluster using kubeadm via Ansible.
Apache License 2.0
723 stars 380 forks source link

[ERROR KubeletVersion]: the kubelet version is higher than the control plane version. #87

Closed pantapita closed 3 years ago

pantapita commented 3 years ago

Hi,

I am using this repo to deploy k8s to VMs. Last time (Dec 2020) I did it, and it was elegant and smooth, went without any issues. Today I am stuck with this error initializing cluster.

To reproduce : Workstation = (same from Dec 2020) Ubuntu 40~18.04.1-Ubuntu + Ansible 2.9.20

I create cluster with one master and one worker

Tried all of the following OS versions (master + worker): Ubuntu 18.04 Ubuntu 20.04 CentOS 7 CentOS 8

Tried with two different cloud providers (Serverspace and Contabo)

I also tried the newest repo clone and I tried my "old" clone from Dec 2020, all this combinations resulted with identical error (check below)

Thanks for any clues!

TASK [kubernetes/master : Init Kubernetes cluster] **** Friday 16 April 2021 20:44:39 +0200 (0:00:01.864) 0:03:18.800 ** fatal: [master1]: FAILED! => {"changed": true, "cmd": "kubeadm init --service-cidr 10.96.0.0/12 --kubernetes-version v1.20.1 --pod-network-cidr 10.244.0.0/16 --token b0f7b8.8d1767876297d85c --apiserver-advertise-address 31.44.3.145 \n", "delta": "0:00:00.350402", "end": "2021-04-16 18:44:41.815988", "msg": "non-zero return code", "rc": 1, "start": "2021-04-16 18:44:41.465586", "stderr": "\t[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/\nerror execution phase preflight: [preflight] Some fatal errors occurred:\n\t[ERROR KubeletVersion]: the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: \"1.21.0\" Control plane version: \"1.20.1\"\n[preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...\nTo see the stack trace of this error execute with --v=5 or higher", "stderr_lines": ["\t[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/", "error execution phase preflight: [preflight] Some fatal errors occurred:", "\t[ERROR KubeletVersion]: the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: \"1.21.0\" Control plane version: \"1.20.1\"", "[preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...", "To see the stack trace of this error execute with --v=5 or higher"], "stdout": "[init] Using Kubernetes version: v1.20.1\n[preflight] Running pre-flight checks", "stdout_lines": ["[init] Using Kubernetes version: v1.20.1", "[preflight] Running pre-flight checks"]}

PLAY RECAP ****

Sh4peSh1fter commented 3 years ago

Hey @pantapita, I got the same error running the playbook on CentOS 7 VM's.

This happens because when installing the dependencies (through the meta file - roles/kubernetes/master/meta/main.yml), the latest version of kubelet, kubeadm, and kubectl is installed, while the kubernetes version that is used in the kubeadm init command is the one that declared in the group vars. The version of the control plane is the same as the kubernetes version you use so the stderr simply hints you that you should use a higher version.

Changing it to the latest version (now for example it's 1.21.0) should fix the problem and works fine for me :)

EDIT: I forgot to mention that I didn't look at the "old" clone from 2020, but it probably worked on those times because the latest kubelet version then supported the kubernetes version declared in the group vars in this clone.

pantapita commented 3 years ago

Thanks, this worked for me as well.