1. Introduction
Kubernetes is a powerful open-source platform for automating the deployment, scaling, and management of containerized applications. Primarily useful for large-scale distributed systems, it can also be deployed on a single node for development and testing purposes. This guide will walk you through the step-by-step process of installing and configuring a single-node Kubernetes cluster on Ubuntu 24.04 LTS.
2. Prerequisites
- A machine with Ubuntu 24.04 LTS (recommended minimum 2 CPUs, 2GB RAM, 20GB storage)
- Root or sudo privileges
- Internet connectivity
3. Installation Procedure
3.1 Update the System and Install Prerequisite Packages
First, let’s update your system to the latest state and install some essential base packages.
|
|
3.2 Install Docker
Kubernetes requires a container runtime, and we will be using Docker for that.
|
|
3.3 Install Kubernetes Components
Now, let’s install the core Kubernetes components: kubelet, kubeadm, and kubectl.
|
|
3.4 Configure the System
A few system settings need to be adjusted for Kubernetes to work correctly.
|
|
3.5 Configure containerd
Let’s also configure containerd to work with Kubernetes.
|
|
3.6 Pull kubeadm Images
Before initializing the Kubernetes cluster using kubeadm, let’s pull the required images in advance.
|
|
3.7 Initialize the Kubernetes Cluster
We are now ready to initialize the Kubernetes cluster.
|
|
Upon successful initialization, you should see output similar to:
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join <your-master-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash>
Follow the instructions to complete the kubectl setup:
|
|
3.8 Install a Network Plugin
For pods to communicate with each other, we need to install a network plugin. We will be using Calico:
|
|
3.9 Complete Single-Node Setup
By default, Kubernetes does not schedule workloads on the control plane node. To enable running workloads on the master node, execute the following command:
|
|
4. Verify Cluster Status
With the installation complete, let’s verify the status of our cluster:
|
|
If everything is set up correctly, you should see output similar to:
NAME STATUS ROLES AGE VERSION
your-hostname Ready control-plane 5m v1.30.x
5. Conclusion
Congratulations! You have successfully deployed a single-node Kubernetes cluster on Ubuntu 24.04 LTS. This environment is suitable for development, testing, and learning purposes. For production deployments, it is recommended to set up a multi-node cluster for high availability and scalability.