Skip to main content

Installation Using Kubeadm for a Single-Node Kubernetes Cluster

Kubeadm is a tool provided by Kubernetes to create and manage clusters. You can use Kubeadm to set up a single-node Kubernetes cluster on a single server (master node) and run your workloads there.

Step 1: Install Kubernetes Components You will need to install kubeadm, kubelet, and kubectl on your server.

For Ubuntu/Debian-based systems:

# Update the system
sudo apt update && sudo apt upgrade -y

# Install required packages
sudo apt install -y apt-transport-https ca-certificates curl

# Add Kubernetes APT repository
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update

# Install Kubernetes components
sudo apt install -y kubelet kubeadm kubectl

Error Debugging

I got this error when I executed the last command.

No apt package "kubeadm", but there is a snap with that name.
Try "snap install kubeadm"

No apt package "kubectl", but there is a snap with that name.
Try "snap install kubectl"

No apt package "kubelet", but there is a snap with that name.
Try "snap install kubelet"

So, I do this recommend.

1. Install Snap (if not already installed)

If snap is not installed on your system, you can install it with the following commands:

sudo apt update
sudo apt install snapd

2. Install kubeadm, kubectl, and kubelet using Snap

Once snapd is installed, you can use it to install the Kubernetes tools. Use the following commands:

sudo snap install kubeadm --classic
sudo snap install kubectl --classic
sudo snap install kubelet --classic

The --classic flag ensures that the snaps are installed in classic mode, which allows them to have access to system resources outside of the snap sandbox.

3. Verify the Installation

After installation, you can check if the tools are properly installed by running:

kubeadm version
kubectl version --client
kubelet --version