
Kubeadm Kubernetes
Kubernetes is an open-source platform for automating deployment, scaling, and management of containerized applications. In this tutorial, you will learn how to install and set up a Kubernetes cluster using kubeadm.
Before you start, make sure your system meets the following requirements:
A Linux operating system, such as Ubuntu or CentOS. Docker installed and running on all nodes. Minimum of 2 GB of RAM and 2 CPU cores on each node. The latest version of kubeadm, kubelet, and kubectl. Step 1: Install Docker
If you donβt already have Docker installed, you can install it by following these steps:
For Ubuntu:
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker
sudo systemctl enable docker
For CentOS:
sudo yum install docker
sudo systemctl start docker
sudo systemctl enable docker
Step 2: Install kubeadm, kubelet, and kubectl
The latest version of kubeadm, kubelet, and kubectl can be installed using the following commands:
For Ubuntu:
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
For CentOS:
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
sudo yum install -y kubelet kubeadm kubectl
sudo systemctl enable --now kubelet
Step 3: Initialize the Cluster
On the first node, initialize the cluster using the kubeadm init command:
sudo kubeadm init
This command will output a set of instructions for joining other nodes to the cluster, which you will use in Step 4.
Step 4: Join the Nodes
On each additional node, use the join command provided by kubeadm init to join the node to the cluster:
kubeadm join <control-plane-host>:<control-plane-port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>