Install Kubernetes Cluster - Setting Up the Control Plane and Worker Nodes (Part 1)
You just want to get a local environment up and running, one that feels like an enterprise-grade setup but without all the complexity. Look no further! In this post, I’ll show you how to set up a Kubernetes cluster quickly and efficiently, and get a local environment that mirrors what you'd expect in a real production scenario.
Why This Guide?
This guide is for anyone who wants to skip the deep dives and get a fully functional Kubernetes cluster running ASAP. We’ll cover the essentials—setting up control plane, worker nodes, networking, load balancing, and monitoring. By the end, you’ll have a setup that feels production-grade (without all the overhead).
What's in the Box?
This isn't your average, bare-bones Kubernetes setup. Oh no, we're going full enterprise here:
- Kubernetes control plane and worker nodes.
- Containerd as the container runtime (Docker who?).
- Cilium for networking (CNI).
And yes, all this on your Debian-based OS. It's like having a full IT team in one script—just hit “run.”
Prerequisites
Before we dive in, make sure you've got:
- A Debian-based OS installation.
- At least 4 GB of RAM and 2 CPUs per machine.
- Internet access.
Let's Get This Party Started!
Clone the repository
First you need to ssh
to your control plane node and clone the repo that includes all the files you need for this setup.
git clone https://github.com/fresher-to-uber/k8s-cluster-setup.git
cd k8s-cluster-setup
Deploy a Control Plane node, run the setup and capture the output (you might need it, who knows?)
$ bash control-plane.sh | tee output.txt
The output in the terminal should look like this
Next, on the second node, run the worker script
$ bash worker.sh | tee output.txt
Join your worker node to cluster by using kubeadm join
, the command can be found at the output file on control plane node
sudo kubeadm join 192.168.20.128:6443 --token z4432o.wk9ekcejzgg7bg4o \
--discovery-token-ca-cert-hash \
sha256:22afcc7498653f7e3980261f2e4a7190655ac0291c55c66d006ebc701486e8ab
If nothing's wrong, you should see both node are ready
Deploy a nginx basic pod
Now we will deploy a nginx app for testing
kubectl create deployment firstpod --image=nginx
Verify the pod is running
kubectl get pod -o wide
Access the webserver by using curl
and the pod IP you should see the default nginx page
curl http://10.0.1.61
Conclusion
Congrats! You’ve survived setting up the control plane and worker nodes, and your cluster is looking pretty good. Now it’s time to gear up for part two, where we add the real fun with monitoring and ingress. Because why stop at “just working” when we could add even more layers?
And you can find the script .