Install Kubernetes on Ubuntu With Commands That Just Work
I still remember the first time I tried to install Kubernetes on a fresh Ubuntu server.
The clock on my laptop ticked louder and louder as I ran each command, one at a time, feeling both curious and uneasy.
It was a leap from mere curiosity into something real. I was building a tiny cluster, but in that moment it felt immense.
And then one command worked… and another… and suddenly the pieces were clicking into place.
In this article you will learn how to set up Kubernetes on Ubuntu like a human — with clear steps, real commands, honest explanation, and practical tips that save time.
Why This Matters
Most guides are either too short or too abstract. They say:
Install this. Run that. Good luck.
That is confusing when you are staring at a terminal and feel stuck.
Here I will walk you through each command, what it does, and why it matters.
What Kubernetes Really Is and Why It Feels Heavy at First
Kubernetes rarely enters a developer’s life gently. Most people do not discover it out of curiosity. They encounter it as a requirement. It appears in job descriptions, architecture diagrams, and certification roadmaps long before it appears as understanding. By the time someone sits down to install it, they already feel behind.
That discomfort is not accidental. Kubernetes is not just another tool you install and forget. It represents a shift in how software is built, deployed, and kept alive. When people struggle with Kubernetes, they are usually not struggling with commands. They are struggling with a new mental model.
At its heart, Kubernetes exists because software stopped being small. Applications no longer live on a single server where cause and effect are obvious. They live across machines, networks, and failure domains. Once software reaches that point, manual coordination stops working. Humans cannot react fast enough, consistently enough, or calmly enough. Kubernetes exists to take over that responsibility.
Containers were the first big step toward this world. Docker made it possible to package applications in a way that behaved consistently across environments. That alone solved years of frustration. But containers also multiplied complexity. One container was manageable. Hundreds across multiple machines were not. Containers crashed. Nodes disappeared. Traffic surged without warning. Kubernetes emerged as a response to that chaos, not as an abstract invention.
What Kubernetes offers is not control, but stability. Instead of telling the system exactly what to do and when to do it, you describe what you want the system to look like. You define how many instances should exist, how they should communicate, and what resources they need. Kubernetes then works continuously to make reality match that description. When something fails, it does not ask for permission. It simply restores balance.
This is why Kubernetes is declarative by design. Commands are fleeting. They act once and then vanish. Declarations persist. They represent intent. Kubernetes constantly compares the current state of the system to the desired state you described. When the two drift apart, reconciliation begins. This quiet loop is what gives Kubernetes its resilience. It is not reactive. It is steady.
One of the most common misunderstandings is thinking that Kubernetes runs containers directly. It does not. It runs pods. A pod is a small execution unit that can contain one or more containers sharing networking and storage. Kubernetes schedules pods, replaces them when they fail, and scales them when needed. Once this distinction becomes clear, many confusing behaviors suddenly make sense.
When you set up Kubernetes, you create a control plane. It can feel like a central brain, but its role is coordination rather than execution. The real work happens on each node, where agents carry out the decisions made by the control plane. This separation allows the system to survive failures gracefully. If a node disappears, workloads are rescheduled elsewhere without drama.
Networking is often where Kubernetes feels the most opaque. Every pod receives its own IP address and can communicate across nodes as if everything were on the same local network. This illusion is created through overlay networking solutions like Flannel. The abstraction is powerful, but invisible. When something goes wrong, there is nothing tangible to point at, which is why Kubernetes networking issues can feel so frustrating.
There is a common belief that Kubernetes is only useful at massive scale. In reality, its value comes from predictability. Even small systems benefit from consistent deployments, self-healing behavior, and clear separation of responsibilities. Kubernetes enforces good habits early, long before systems become fragile. Learning it on a single Ubuntu machine is not overkill. It is preparation.
Kubernetes feels overwhelming because it does not hide the truth. Distributed systems are complex. Failure is normal. State is fragile. Kubernetes does not pretend otherwise. It acknowledges these realities and builds mechanisms to deal with them calmly and continuously. Once that perspective settles in, Kubernetes stops feeling excessive and starts feeling honest.
Installing Kubernetes manually teaches more than configuration. It teaches how systems establish trust, how coordination happens without central control, and how reliability is engineered rather than hoped for. These lessons stay with you even if you never manage a production cluster.
The real value of Kubernetes is not that it is popular. It is that it encodes years of operational experience into a system that does not get tired, forget, or panic. Humans do those things. Kubernetes does not. That is why it exists, and that is why learning it properly is worth the effort.
From Understanding to Action
Understanding Kubernetes conceptually is important, but understanding it through action is where things truly settle. Installation is not just a setup task. It is the first real conversation you have with the system. Each command you run reveals how Kubernetes expects the world to be shaped, how it establishes trust, and how it prepares itself to make decisions later. By installing Kubernetes yourself, rather than relying on managed services, you gain intuition that no diagram can provide. With that context in mind, the steps below are not just instructions to follow. They ar.,e a guided walk through how Kubernetes brings itself to life on an Ubuntu machine.
What You Need Before You Start
You need two things:
- A machine running Ubuntu (20.04, 22.04 or later) — virtual or physical.
- A user with sudo rights — this lets you run privileged system commands.
If you have those, you are ready.
Update and Prepare the System
You start with one simple command to make sure everything is fresh:
sudo apt update
sudo apt upgrade -yThis keeps all packages up to date and prepares your system for the installation ahead.
It is like tuning an engine before a long drive.
Install Docker
Kubernetes needs a container runtime. Docker is the most familiar one.
sudo apt install -y docker.io
sudo systemctl enable docker
sudo systemctl start dockerDocker will run containers which Kubernetes will orchestrate. Without this, the cluster just cannot function.
Check Docker’s status:
sudo systemctl status dockerYou want to see “active (running)” — if not, something is wrong.
Add Kubernetes Repository
Kubernetes packages are not in the default Ubuntu repositories. You add them with these steps.
Create the keyring directory:
sudo mkdir -p /etc/apt/keyringsDownload the signing key:
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key
sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgThis ensures our system will trust Kubernetes packages.
Add the repository:
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.listNow update your package list again.
Install kubeadm, kubelet, kubectl
These are the core components:
- kubeadm — Bootstraps your cluster
- kubelet — Runs on every node
- kubectl — Command-line tool you use to control it
Run:
sudo apt install -y kubeadm kubelet kubectlThen prevent them from updating automatically (so your cluster does not break later):
sudo apt-mark hold kubeadm kubelet kubectlInitialize the Cluster
This is the part that feels magical.
Run:
sudo kubeadm init --pod-network-cidr=10.244.0.0/16You will see a lot of output — take a moment here. This command sets up the control plane.
When it finishes, it will show a join command. Save that — you will use it later if you add more nodes.
Set Up Local kubectl Access
On your local machine, run:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configThis lets your terminal speak to your new cluster.
Install a Network Add-on
Kubernetes needs a network solution. We use Flannel here because it is simple and reliable.
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.ymlAfter this, your cluster nodes will communicate with each other.
Check Your Cluster
Finally, see what is running:
kubectl get nodes
kubectl get pods --all-namespacesYou should see your control plane node ready and running.
And just like that you have a working Kubernetes cluster.
What To Do Next
Once you install Kubernetes, you might feel like there is a huge universe around you.
There is. And you walk into it one step at a time.
Try:
- Adding more nodes
- Deploying a simple app
- Observing pods in action
- Exploring kubectl commands
You will grow comfortable with it slowly… and then one day you realize you are fluent.
At first it felt uncertain.
Now it feels powerful.
You got this.
