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"
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.
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)
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:
kubelet --version
kubeadm version
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
sudo apt-mark hold docker-ce kubelet kubeadm kubectl