Cannot install packages on CentOS 7

I am trying to install kubelet and kubeadm on a new node which has a fresh CentOS 7 environment. However, when I follow the instructions from Installing kubeadm - Kubernetes I am unable to install the packages. I ran these commands.

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
exclude=kubelet kubeadm kubectl
yum install -y kubelet kubeadm kubectl –disableexcludes=kubernetes

That output gives…

[root@k8sworker1 yum.repos.d]# yum install -y kubelet kubeadm kubectl –disableexcludes=kubernetes
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
No package kubelet available.
No package kubeadm available.
No package kubectl available.
Error: Nothing to do

Could you try install without the exclude= line in repo config?
Then add it back after the install.

Kind regards,

There is a typo in docs ( is used instead of --).
This one is correct: yum install kubelet kubeadm kubectl --disableexcludes=kubernetes

Also I do it different way:
I skip exclude=kubelet kubeadm kubectl line from .repo file, in instead I use versionlock yum plugin


yum install -y yum-plugin-versionlock
yum versionlock delete docker-ce docker-ce-cli kubelet kubeadm kubectl kubernetes-cni || true
yum install -y \
    kubelet-1.17.4-0 \
    kubeadm-1.17.4-0 \
    kubectl-1.17.4-0 \
    kubernetes-cni-0.7.5-0 \
    docker-ce-19.03.9-3.el7 docker-ce-cli-19.03.9-3.el7
yum versionlock add docker-ce docker-ce-cli kubelet kubeadm kubectl kubernetes-cni

I was able to get it to work by removing the excludes from the repo file. But when you pointed out the — error that makes sense. Thank you.

Thanks for catching that – As a follow up would you mind opening up a PR or issue to fix that in the docs? Should be able to get that fixed upstream pretty quick :+1:

@mrbobbytables I went to submit a PR. It’s fixed in master and release-1.18 has no excluded line so there seems to be shifting direction. Is there an official stance?

Do you mean backporting it to the 1.17 documentation?
Usually those changes aren’t backported to previous versions. Each version has its own branch and with the rate at which the repo is updated, it’d be very difficult to know which ones to cherry pick a fix to =/

I’m saying do a patch against 1.18 since master already appears to be correct.

I’m not really sure how it happened, the commit that introduced --disableexcludes=kubernetes has been correct since the beginning: yet, Installing kubeadm - Kubernetes demonstrates this long hyphen instead of 2 consequent minus signs --, and it’s true for both disableexcludes and for systemctl enable –now kubelet for example.

Looks like hugo is converting 2 consequent minuses into long hyphen.