Introduction
As the cloud-native landscape continues to evolve, Kubernetes remains the industry standard for container orchestration. With the release of Ubuntu 24.04 LTS (Noble Numbat), DevOps engineers have access to a stable, long-term supported platform for managing containerized workloads. This guide provides a detailed walkthrough to get your cluster up and running.
Prerequisites
- A minimum of two Ubuntu 24.04 server instances (one Control Plane and one Worker Node).
- At least 2 GB of RAM and 2 CPUs per node.
- Full network connectivity between all nodes.
- Sudo privileges on all machines.
- A unique hostname, IP address, and MAC address for every node.
Step 1: System Update and Hostname Configuration
Before installing any software, it is vital to ensure your system is up to date. Update the local package index and upgrade the installed packages on all nodes. Additionally, set unique hostnames for your master and worker nodes to prevent identification conflicts within the cluster.
Step 2: Disable Swap Memory
Kubernetes requires swap memory to be disabled on all nodes for the kubelet to function correctly. This ensures that the scheduler can accurately manage resource allocation. Use the swapoff command and update the /etc/fstab file to make this change persistent across reboots.
Step 3: Configure Network Bridging
To allow the Kubernetes cluster to communicate across the nodes, you must enable the overlay and br_netfilter kernel modules. Once enabled, configure the system to allow iptables to see bridged traffic by updating the sysctl configuration. This step is critical for the networking plugin to function as intended.
Step 4: Install Container Runtime (Containerd)
Kubernetes uses a Container Runtime Interface (CRI) to manage the lifecycle of containers. On Ubuntu 24.04, containerd is the preferred choice. Install the containerd package, generate the default configuration file, and ensure the SystemdCgroup option is set to true to align with Kubernetes requirements.
Step 5: Install Kubeadm, Kubelet, and Kubectl
Now, install the core Kubernetes components. Kubeadm is used to bootstrap the cluster, Kubelet runs on every node to manage pods, and Kubectl is the command-line utility used to interact with the cluster. Add the official Kubernetes repository to your system, install the packages, and pin their versions to prevent accidental updates.
Step 6: Initialize the Control Plane
On the master node, initialize the cluster using the kubeadm init command. You should specify the pod network CIDR to match the networking plugin you intend to use. Once the initialization is complete, the command will provide a join token for your worker nodes.
Step 7: Configure Non-Root Access
To manage the cluster as a regular user, copy the administrator configuration file to your home directory. This allows you to run kubectl commands without needing sudo privileges, which is a best practice for DevOps security.
Step 8: Deploy a Pod Network Plugin
Pods require a network to communicate with each other. Deploy a Container Network Interface (CNI) plugin such as Calico or Flannel. This software facilitates the virtual networking infrastructure that allows containers on different nodes to reach one another seamlessly.
Conclusion
Installing Kubernetes on Ubuntu 24.04 provides a powerful environment for modern application development and deployment. By following these steps, you have successfully established a foundation for a production-grade container orchestration system. From here, you can join worker nodes, deploy applications, and explore the vast ecosystem of Kubernetes-native tools.
