Kubernetes feels intimidating at first — but you do not need a multi-node cloud cluster to learn it. Setting up a single-node Kubernetes cluster on Ubuntu 22.04 gives you a fully functional environment to experiment, develop, and understand how K8s works before touching production.
Prerequisites: Ubuntu 22.04 server or VM (minimum 2 CPUs, 2GB RAM — 4GB recommended), a non-root user with sudo privileges, and basic familiarity with the Linux terminal.
What Is a Single-Node Kubernetes Cluster?
In a production Kubernetes environment, you have multiple nodes: control plane nodes managing the cluster and worker nodes running your applications. In a single-node setup, one machine plays both roles. This is perfect for learning Kubernetes without cloud costs, local development, and CI/CD pipeline testing.
kubeadm vs Minikube vs K3s
| Tool | Best For | Complexity |
|---|---|---|
| kubeadm | Production-like single-node setup | Medium |
| Minikube | Pure local development | Low |
| K3s | Lightweight production clusters | Low-Medium |
This guide uses kubeadm because it mirrors real-world cluster setup and prepares you for multi-node clusters later.
Step 1 — Prepare Your Ubuntu 22.04 System
sudo apt update && sudo apt upgrade -y
sudo swapoff -a
sudo sed -i "/ swap / s/^/#/" /etc/fstab
sudo hostnamectl set-hostname k8s-master
Verify swap is off: free -h — the swap row should show 0B. Then load required kernel modules:
sudo modprobe overlay
sudo modprobe br_netfilter
cat <<CONF | 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
CONF
sudo sysctl --system
Step 2 — Install Container Runtime (containerd)
sudo apt install -y containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
# Edit: change SystemdCgroup = false to SystemdCgroup = true
sudo nano /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
Step 3 — Install kubeadm, kubelet, and kubectl
sudo apt install -y apt-transport-https ca-certificates curl gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/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.29/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Step 4 — Initialize the Kubernetes Cluster
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=all
This takes 2–5 minutes. When complete, copy and save the kubeadm join command shown in the output. Then configure kubectl access:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get nodes
Step 5 — Install Flannel Network Plugin
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
Wait 60 seconds then run kubectl get nodes — status should show Ready. Then remove the control-plane taint to allow pod scheduling:
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
Step 6 — Deploy Your First Application
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=NodePort
kubectl get services
curl http://localhost:<NodePort>
You should see the Nginx welcome page — your Kubernetes single-node cluster is fully operational.
Essential kubectl Commands
kubectl get nodes # List all nodes
kubectl get pods --all-namespaces # All pods
kubectl describe pod <pod-name> # Debug a pod
kubectl logs <pod-name> # View pod logs
kubectl delete deployment nginx # Remove deployment
kubectl get componentstatuses # Cluster health
Troubleshooting Common Issues
Node stuck in NotReady state
Usually caused by a missing or failed CNI plugin. Re-apply Flannel and check kubectl get pods -n kube-flannel.
kubeadm init fails — port already in use
sudo kubeadm reset
sudo rm -rf /etc/kubernetes /var/lib/etcd
sudo kubeadm init --pod-network-cidr=10.244.0.0/16
kubectl connection refused
Run export KUBECONFIG=/etc/kubernetes/admin.conf and test. If it works, redo the kubeconfig setup from Step 4.
Next Steps
- Set up Grafana dashboards to monitor your cluster
- Configure a CI/CD pipeline with GitHub Actions
- Explore Docker Compose on Ubuntu 22.04 for simpler multi-container setups
- Learn about Kubernetes namespaces, ConfigMaps, and Secrets
Frequently Asked Questions
What is the minimum RAM for Kubernetes on Ubuntu 22.04?
2GB minimum, but 4GB is strongly recommended. With only 2GB, system pods alone consume most available memory, leaving little for your applications.
Should I use kubeadm or Minikube?
Minikube is simpler for pure learning. kubeadm gives you experience that directly maps to production environments, making it the stronger choice for developers planning to work with real clusters.
How do I completely reset a kubeadm cluster?
Run sudo kubeadm reset, then remove /etc/kubernetes and /var/lib/etcd, and re-initialize with kubeadm init.
Is a single-node Kubernetes cluster production-ready?
For small, non-critical workloads, yes. For high availability you need at least 3 control plane nodes plus dedicated worker nodes.
About the Author: Anoop Patel is a Linux systems engineer and DevOps practitioner with hands-on experience deploying Kubernetes clusters at Tech-Slave.com.

















