I am trying to create a high availability cluster using the kubeadm tool. And I am trying to install the tools that specified in the pre-requistics of kubeadm installation. When I am running sudo apt-get install -y kubelet kubeadm kubectl
, I am getting the error like the following,
Building dependency tree
Reading state information... Done
E: Unable to locate package kubelet
E: Unable to locate package kubeadm
E: Unable to locate package kubectl
My Attempt
I am following the following official documentation for preparing the nodes from kubernetes.io. I am refering the following link for that,
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#before-you-begin
Ans when I am continuing with following commands as described in the official documentation,
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Updates
When I tried the answer from Mr.Tummala, I am getting the error like the following,
W: Failed to fetch https://apt.kubernetes.io/dists/kubernetes-xenial/InRelease Could not resolve host: apt.kubernetes.io
W: Some index files failed to download. They have been ignored, or old ones used instead.
But result like unable to locate the package.
kubeadm: the command to bootstrap the cluster. kubelet: the component that runs on all of the machines in your cluster and does things like starting PODs and containers. kubectl: the command line until to talk to your cluster.
See if the below steps are doing the trick for you.
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
I would refer to the official documentation https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-kubeadm-kubelet-and-kubectl
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
Then,
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
Finally
sudo apt-get update
# Optionally, view versions with
# sudo apt-cache show kubectl
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Try curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
then sudo bash -c 'cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF'
after it just run sudo apt-get update
and then apt-cache policy kubelet | head -n 20
now you can try to install kubectl and kubeadm again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With