Kubernetes Day 1: When I Met the Cluster (and Didn't Cry!) ๐

Hey there, fellow tech explorers! ๐ Ever felt like everyone's talking about Kubernetes like it's the secret sauce to everlasting happiness and perfectly deployed apps? Yeah, me too! So, on my very first day diving into the magical world of K8s, I decided to go big or go home. Forget the kiddie pools; we're jumping straight into the cloud ocean with AWS EC2! ๐
Why AWS EC2 for Day 1? Because Local is Soooo Last Season (Mostly ๐)
Okay, okay, your laptop is cool. But setting up Kubernetes on AWS EC2 from the get-go is like skipping straight to the advanced level of a video game. You instantly get a crash course in:
Networking: "Wait, why can't my app talk to the internet?!" (Spoiler alert: AWS Security Groups are like the bouncers for your cloud club. No invite, no entry! ๐ โโ๏ธ)
Remote Control: Feeling like a hacker, SSH-ing into your fancy cloud computer. Access granted! ๐ป
Resource Management: Realizing your free-tier instance isn't quite ready to host Netflix. Oops! ๐ฌ
The "Big Picture": It feels less like playing with toys and more like building a legitimate server setup. Adulting, but with more emojis! โจ
Meet the Cluster Crew: kubeadm, Minikube, and Kind (My New Best Friends... Mostly)
Before we start the party, let's introduce the three musketeers who helped me conjure my first K8s clusters:
kubeadm
: This is the Gandalf of Kubernetes. ๐งโโ๏ธ It helps you build a proper, grown-up K8s cluster from the ground up. It's powerful but demands you learn a few ancient spells (commands). Think of it as building your own custom gaming PC from scratch. Satisfying, but you might need a few tutorials open!Minikube
: My personal K8s sidekick! ๐ฆธโโ๏ธ It whips up a tiny, single-node Kubernetes cluster right inside a virtual machine or a Docker container. Perfect for quick local tests and when you just need K8s to "work" without fuss. It's like buying a pre-built gaming console โ plug and play!Kind
(Kubernetes IN Docker): The speedy ninja! ๐ฅ Kind creates K8s clusters using Docker containers as its "nodes." It's super fast, ephemeral, and a favorite for automated testing. Imagine a super-efficient, disposable arcade machine for quick K8s battles! ๐ฎ
My Day 1 mission: Get each of these running on their own little EC2 island, just to see what makes them tick. And let me tell you, it was an adventure! ๐
The Pre-Party Prep: Gearing Up on AWS EC2 ๐ ๏ธ
For each cluster's grand debut, I spun up a fresh Ubuntu Server 22.04 LTS EC2 instance. I went with t2.medium
or t3.medium
because, well, they have enough brainpower (RAM) to avoid a total meltdown. ๐ง ๐ฅ
The Universal EC2 Setup Checklist (aka, "Don't Skip These Steps Unless You Like Pain"):
Launch Instance:
Ubuntu Server 22.04 LTS (My go-to flavour of Linux ice cream ๐ฆ).
A decent instance type (no potato PCs here! ๐ฅ๐ซ).
CRUCIAL BIT: Security Group! This is your network's velvet rope. Make sure SSH (port 22) can get in from your IP. For K8s, you'll eventually open more ports, but baby steps! ๐ฃ
SSH In: Time to feel like a super hacker. ๐ฉโ๐ป
Bash
ssh -i "your-super-secret-key.pem" ubuntu@your-cloud-computer's-address
Docker Time! (Because Minikube and Kind are obsessed with Docker, and
kubeadm
likes it too):Bash
sudo apt update # Freshen up the pantry ๐ sudo apt install -y docker.io # Get Docker installed, yay! ๐ณ sudo systemctl start docker # Wake Docker up! ๐ดโก๏ธ๐ sudo systemctl enable docker # Tell Docker to wake up with the computer every time! โ๏ธ sudo usermod -aG docker $(whoami) # Add yourself to the "cool kids" Docker group. ๐ newgrp docker # Apply the "cool kids" group membership NOW (or just log out/in like a normal human ๐คทโโ๏ธ)
The Main Event: Cluster Creation! ๐
(Imagine me, a brave explorer, battling command line dragons!)
Adventure 1: The kubeadm
Grand Expedition (Building Your Own K8s Kingdom) ๐ฐ
This is where you truly understand how Kubernetes works. It's like assembling IKEA furniture, but instead of missing screws, you might miss a network config. ๐
Steps (on its own dedicated EC2 instance):
"No Swap Allowed!" Kubernetes is picky. It hates memory "swapping" to disk, so we kill it.
sudo swapoff -a # Goodbye, swap! sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab # Make it permanent
K8s Prerequisites (Magic Incantations): These commands tell the Linux kernel how to play nicely with Kubernetes' network.
# Don't worry about understanding these fully on Day 1, just copy-paste! cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf overlay br_netfilter EOF sudo modprobe overlay sudo modprobe br_netfilter 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 # Apply the new rules
Get
kubeadm
,kubelet
,kubectl
: These are the tools Kubernetes needs to live.sudo apt update sudo apt install -y apt-transport-https ca-certificates curl gnupg 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 # Prevent accidental updates
(Psst! Check the Kubernetes docs for the absolute latest version if v1.29
feels old.)
Initialize the Control Plane (The Brains of the Operation): This is the big one!
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=$(hostname -I | awk '{print $1}')
--pod-network-cidr
: This is for the internal network where your app "pods" will live. Think of it as their secret clubhouse IP range.--apiserver-advertise-address
: Tells Kubernetes to use this EC2 instance's IP for its main communication hub.
Let
kubectl
Talk to Your Cluster:kubeadm
will give you some lines to copy-paste. Do it! It creates a config file sokubectl
knows where to find your new cluster.mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Install a Pod Network (Flannel, the Simple Choice): Your pods need a way to chat with each other. Flannel is like a simple internal phone system.
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
Victory Check!
kubectl get nodes # Should see your EC2 instance "Ready" kubectl get pods -A # See all the internal K8s brains running
Adventure 2: The Minikube Express (Your Personal K8s Sandbox) ๐๏ธ
This one is like a magic easy button for a single-node cluster. Minikube makes K8s feel almost... friendly? ๐ค
Steps (on its own dedicated EC2 instance, after Docker & kubectl
are set up):
Download Minikube: Grab the Minikube binary.
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube rm minikube-linux-amd64
Start Minikube!
minikube start --driver=docker # Tell it to use the Docker we installed
Quick Check:
kubectl get nodes # You'll see a node called "minikube" minikube status # Check its heartbeat
Adventure 3: The Kind Ninja Kick (Fast & Furious K8s in Docker) โก
Kind is all about speed and simplicity. It uses Docker to create its nodes, making it super lightweight and perfect for when you need a cluster, like, right now. ๐จ
Steps (on its own dedicated EC2 instance, after Docker & kubectl
are set up):
Download Kind:
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 # Get the Kind binary chmod +x ./kind # Make it executable sudo mv ./kind /usr/local/bin/kind # Put it where your system can find it
(Heads up: Check Kind's GitHub for the very latest version if that
v0.22.0
looks ancient in the future!)Create a Kind Cluster (The Easiest Step!):
kind create cluster
Confirm the Ninja's Arrival:
kubectl get nodes # Look for "kind-control-plane" kind get clusters # See your Kind clusters listed
Day 1 Debrief: What I Learned (and What Made Me Scratch My Head!) ๐ค
Phew! Three clusters, three different flavors of Kubernetes goodness. Here's my Day 1 wisdom, fresh off the EC2 presses:
kubeadm
is like building a custom gaming PC: You get ultimate control, but you have to connect all the wires yourself. Very satisfying when it finally boots up, though! โจMinikube
andKind
are your K8s fast-food options: Need a cluster, like, 5 minutes ago? Bam! They're quick, easy, and disposable. Perfect for when you just want to test an app idea without the setup drama. ๐๐Networking is the silent killer: Seriously, those AWS Security Groups are the strict librarians of your network. Get them wrong, and nothing works. "NO TALKING IN THE CLOUD!" ๐
kubectl
is your universal remote: No matter how you set up your cluster,kubectl
is the magic wand you'll use to talk to it. Get comfy with it; it's your new best friend! ๐ชClusters are fleeting (for now): These Day 1 setups aren't built for saving your precious data forever. For that, you'd dive into things like persistent volumes or managed services (like AWS EKS), but that's a story for another day! ๐
This Day 1 was just the very first dip of my toes into the vast Kubernetes ocean. Next up? Deploying actual applications, wrestling with YAML (the dreaded config language! ๐ป), and probably breaking a few more things (it's part of the fun, right?! ๐ ).
What was your funniest or most frustrating "Day 1" with Kubernetes? Share your tales of triumph (or woe) in the comments below! Let's laugh and learn together! ๐
Subscribe to my newsletter
Read articles from Hritik Raj directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Hritik Raj
Hritik Raj
๐ Hey there! I'm a university student currently diving into the world of DevOps. I'm passionate about building efficient, scalable systems and love exploring how things work behind the scenes. My areas of interest include: โ๏ธ Cloud Computing ๐ง Networking & Infrastructure ๐ข๏ธ Databases โ๏ธ Automation & CI/CD Currently learning tools like Docker, Kubernetes, and exploring various cloud platforms. Here to learn, build, and share my journey. Letโs connect and grow together! ๐