Unable to connect worker node to kubernetes cluster

7/17/2018

Getting the below mentioned error while trying to connect to cluster from worker node.

Cluster version is 1.10.4 and node version is 1.11.0

[discovery] Successfully established connection with API Server "10.148.0.2:6443"
[kubelet] Downloading configuration for the kubelet from the "kubelet-config-1.11" ConfigMap in the kube-system namespace
configmaps "kubelet-config-1.11" is forbidden: User "system:bootstrap:7fho7b" cannot get configmaps in the namespace "kube-system"
-- Sanket Shirode
kubernetes
linux
ubuntu-16.04

3 Answers

7/18/2018

Due to the fact that you use various kubeadm versions, there is a mismatch between control (master) node and worker node for kubelet-config-1.* config maps.

Check your Configmap for kube-system namespace on your primary control node:

kubectl get configmap -n kube-system

I assume that result value for kubelet-config version will be different than kubelet-config-1.11 from the error message.

Therefore, you should upgrade kubeadm to version 1.11 in order to match your worker node kubeadm version.

There was a similar case discussed on GitHub.

-- mk_sta
Source: StackOverflow

11/7/2018

The issue is not kubeadm version, but rather the kubelet version.

When you run kubeadm join, kubeadm will look on which kubelet version is installed in the host system, and then it will ask the API server for the correct configuration.

The code for this is here:

// DownloadConfig downloads the kubelet configuration from a ConfigMap and writes it to disk.
// Used at "kubeadm join" time
func DownloadConfig(client clientset.Interface, kubeletVersion *version.Version, kubeletDir string) error {

    // Download the ConfigMap from the cluster based on what version the kubelet is
    configMapName := kubeadmconstants.GetKubeletConfigMapName(kubeletVersion)
-- Oz123
Source: StackOverflow

3/3/2019

Definitely check your version of kubeadm and kubelet, make sure the same version of these packages is used along all of your nodes. Prior to installing, you should "mark and hold" your versions of these on your hosts:

check your current version of each:

kubelet --version

check kubeadm

kubeadm version

if they're different, you've got problems. You should reinstall the same version among all your nodes and allow downgrades. My versions in the command below are probably older than what is currently out, you can replace the version number with some more up to date, but this will work:

sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu kubelet=1.12.2-00 kubeadm=1.12.2-00 kubectl=1.12.2-00 --allow-downgrades

then, once they're installed, mark and hold them so they can't be upgraded automatically, and break your system

sudo apt-mark hold docker-ce kubelet kubeadm kubectl

-- texasdave
Source: StackOverflow