Day 32 of 90 Days of DevOps Challenge: Setting up K8 Cluster

Vaishnavi DVaishnavi D
3 min read

Yesterday, I explored how Kubernetes applications can be exposed both internally and externally using Headless Services and Ingress Controllers. I learned how Headless Services enable pod-level discovery perfect for stateful applications, while Ingress provides advanced routing and TLS termination for HTTP/HTTPS traffic from outside the cluster. Today was all about getting my hands dirty by setting up a Kubernetes cluster from scratch!
While I've previously used tools like Minikube for local experimentation, this time I explored the actual building blocks of a Kubernetes environment, the very foundation upon which everything else in the Kubernetes ecosystem operates.

Prerequisites

Before setting up a cluster, there are a few essential tools and configurations required:

1. Linux Environment

A Linux-based OS is essential. I used Ubuntu, but CentOS or RancherOS are also valid options.

2. Docker Installation

Docker is the container runtime required to run containerized workloads. You can install Docker using the official instructions for your OS.

3. Kubernetes CLI Tools

I installed the tools necessary to manage the cluster:

sudo apt-get update && sudo apt-get install -y kubectl kubeadm

Setting Up a Single-Node Cluster (Development Use)

This setup is great for local learning and experimentation:

Step 1: Initialize the Cluster

sudo kubeadm init

Step 2: 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

Step 3: Install a Pod Network (Using Calico)

kubectl apply -f https://docs.projectcalico.org/v3.23/manifests/calico.yaml

Step 4: Allow Pod Scheduling on Control Plane (Not for production)

kubectl taint nodes --all node-role.kubernetes.io/master-

Step 5: Check Cluster Status

kubectl get nodes
kubectl get pods --all-namespaces

Joining Worker Nodes (For Multi-Node Setups)

After initializing the master node, I noted the kubeadm join command, which looks like this:

sudo kubeadm join <master-ip>:<port> --token <token> --discovery-token-ca-cert-hash <hash>

You run this command on each worker node to join them to the cluster.

Setting Up a Production-Grade Multi-Node Cluster

For a production setup:

  • Configure each node carefully with correct security and networking.

  • Use a stable network plugin like Calico, Flannel, or Weave.

  • Ensure security groups and firewalls allow inter-node communication.

  • Optionally, integrate monitoring, storage provisioners, and Ingress controllers.

Verifying the Cluster

Once everything was set up, I verified the state of the cluster using:

kubectl get nodes
kubectl get pods --all-namespaces

Seeing all nodes in the Ready state and system pods running smoothly was super satisfying!

Final Thoughts

Today really helped me understand what goes on before we deploy applications to Kubernetes. Tools like Minikube and managed services make it easy to start, but setting up your cluster teaches you what’s under the hood from networking to pod scheduling.

Learning how to initialize a cluster, configure kubectl, and apply a CNI plugin gave me a solid foundation. I’m starting to feel more confident navigating Kubernetes beyond just the surface-level commands.

Tomorrow, I’ll learn about ReplicaSets. how Kubernetes ensures our applications always run with the desired number of pods.

Stay tuned for Day 33. Things are getting real!

0
Subscribe to my newsletter

Read articles from Vaishnavi D directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vaishnavi D
Vaishnavi D