Kubernetes
Kubernetes architecture is a distributed system designed to manage containerized applications across multiple physical or virtual machines called Nodes. It follows a client-server model with two primary components:
Core Components
Additional Components
Pods: Logical groups of containers.
Kubernetes is highly scalable and fault-tolerant, making it suitable for large-scale deployments15.

Kubernetes offers several tools for installing and managing clusters, each with unique features and use cases. Here's a comparison of kubeadm with other popular tools:
Comparison of Kubernetes Installation Tools
1. kubeadm
Purpose: Initializes a Kubernetes control plane node and joins worker nodes to form a cluster.
Platforms: Supports most Linux distributions, including Ubuntu, CentOS, and Fedora.
Features: Easy to use, supports both bare-metal and cloud environments. It provides a simple way to create and manage clusters.
Limitations: Does not handle infrastructure provisioning; requires manual setup of nodes.
2. kops
Purpose: Automates the provisioning and management of Kubernetes clusters on cloud platforms.
Platforms: Primarily supports AWS, with beta support for GCE and alpha for VMware vSphere.
Features: Handles infrastructure provisioning and cluster management, making it ideal for cloud-native environments.
Limitations: Limited flexibility in terms of deployment platforms compared to other tools.
3. Kubespray
Purpose: Uses Ansible for provisioning and orchestrating Kubernetes clusters across multiple platforms.
Platforms: Supports bare metal and various cloud providers (AWS, GCE, Azure, OpenStack).
Features: Offers high flexibility and customization options due to its use of Ansible. Supports a wide range of Linux distributions.
Limitations: Requires Ansible knowledge and can be more complex to set up compared to kubeadm.
4. Cluster API
Purpose: Provides a declarative API for managing Kubernetes cluster lifecycle, including provisioning and upgrading.
Platforms: Supports multiple infrastructure providers (e.g., AWS, Azure, vSphere).
Features: Focuses on infrastructure as code (IaC) practices, making it suitable for large-scale and multi-cluster environments.
Limitations: Requires more expertise in managing infrastructure as code.
Key Differences
Tool
Primary Use Case
Platforms
Complexity
kubeadm
Simple cluster setup
Most Linux distributions
Low
kops
Cloud-native cluster management
Primarily AWS, GCE (beta), vSphere (alpha)
Medium
Kubespray
Flexible, multi-platform cluster deployment
Bare metal, multiple clouds
High
Cluster API
Declarative cluster lifecycle management
Multiple infrastructure providers
High
Choosing the Right Tool
Use kubeadm for quick, straightforward cluster setup on existing infrastructure.
Choose kops for cloud-native environments, especially AWS.
Select Kubespray for complex, multi-platform deployments requiring high customization.
Opt for Cluster API when managing large-scale, multi-cluster environments with infrastructure as code.
Each tool has its strengths and is suited to different scenarios, making it important to evaluate your specific needs before choosing a Kubernetes installation tool.
Setup
Here’s a comprehensive step-by-step guide to set up a Kubernetes cluster using kubeadm on Ubuntu/Debian-based systems, combining best practices from multiple sources:
Prerequisites
Minimum 2 nodes (1 master, 1+ worker) running Ubuntu 22.04+
SSH access with sudo privileges
At least 2GB RAM and 2 CPUs per node
Unique hostnames for each node (e.g.,
master-node
,worker-1
)
Step 1: Prepare All Nodes
Disable Swap
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab # Permanent disable [1][4]
Configure Kernel Modules
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay && sudo modprobe br_netfilter [1][4]
Enable Bridged Traffic
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system [1][4]
Step 2: Install Container Runtime (containerd)
Install Dependencies
sudo apt update && sudo apt install -y curl gnupg2 [1]
Add Docker Repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update [1][3]
Install containerd
sudo apt install -y containerd.io
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
sudo systemctl restart containerd [1][4]
Step 3: Install Kubernetes Tools
Add Kubernetes Repo
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list [1][3]
Install Packages
sudo apt update && sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl # Prevent auto-updates [1][3]
Step 4: Initialize Control Plane (Master Node)
Bootstrap Cluster
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --control-plane-endpoint=master-node [1][4]
Configure kubectl
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config [1][4]
Step 5: Install Network Plugin (Calico)
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/calico.yaml [4]
Step 6: Join Worker Nodes
Use the kubeadm join
command generated during master initialization:
sudo kubeadm join <master-ip>:6443 --token <token> --discovery-token-ca-cert-hash sha256:<hash> [1][4]
Step 7: Verify Cluster
kubectl get nodes # Should show all nodes as 'Ready'
kubectl get pods -A # Check system pods [4]
Alternative: Single-Node Setup with K3s
For development/testing:
curl -sfL https://get.k3s.io | sh -
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
export KUBECONFIG=~/.kube/config
kubectl get nodes [5]
Troubleshooting Tips
If nodes show
NotReady
, verify network plugin installationCheck
journalctl -u kubelet
for service errorsEnsure port 6443 is open between nodes
This guide combines methodologies from phoenixNAP1, Kubernetes docs2, LinuxConfig3, and DevOpsCube4. For production, consider using managed Kubernetes services like EKS or GKE.
Last updated