Register Now

Login

Lost Password

Enter your email to reset your password.

BY Author

How to Install kubeadm in Linux

To install kubeadm first install Docker on your system. You can find installation instructions for your specific operating system on the Docker website.

Disable swap on your system. Kubernetes requires swap to be disabled in order to function properly. You can disable swap temporarily by running the following command:

sudo swapoff -a

To disable swap permanently, you’ll need to edit your /etc/fstab file and comment out the swap line.

Install the kubeadm package using your system’s package manager. For example, on Ubuntu, you can run:

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

Initialize your cluster using kubeadm. You can run the following command to initialize a new cluster:

sudo kubeadm init

This will download the necessary Kubernetes images and configure your cluster. Once the command completes, it will output a command that you can run on your worker nodes to join the cluster.

Configure kubectl. After initializing your cluster, you’ll need to configure the kubectl command-line tool to communicate with the API server. You can do this by running the following command:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
  1. This will copy the kubeconfig file from the master node to your home directory and set the appropriate permissions.

That’s it! You should now have a working Kubernetes cluster using kubeadm.

Ref from Kubeadm

Verified by MonsterInsights