π Day 27/30 β Kubernetes Basics with AWS EKS | 30 Days DevOps + Cloud + SRE Interview Prep

Series: 30 Days DevOps Interview Preparation
Author: Tathagat Gaikwad
Welcome to Day 27 of my 30-Day DevOps + Cloud + SRE Interview Preparation Challenge.
Todayβs focus is on Kubernetes (K8s) β the de facto standard for container orchestration.
If youβve ever wondered:
π How do big companies like Netflix, Spotify, and Amazon deploy and scale thousands of containers daily?
π How do we ensure applications stay up even if servers fail?
The answer is: Kubernetes.
πΉ What is Kubernetes?
Kubernetes (often abbreviated as K8s) is an open-source container orchestration platform originally developed by Google.
It automates:
π¦ Container deployment
π Scaling applications up or down
βοΈ Load balancing traffic
π Self-healing (restarting failed containers, rescheduling them on healthy nodes)
π Rolling updates and rollbacks
π Think of Docker as a shipping container and Kubernetes as the global logistics company managing thousands of containers across the globe.
ποΈ Core Kubernetes Concepts
Pod β The smallest deployable unit in Kubernetes. A Pod usually runs one container, but can run multiple tightly coupled containers.
Deployment β Ensures that the right number of Pods are running. Provides rolling updates and rollbacks.
ReplicaSet β Maintains a stable set of replicas (Pods).
Service β Exposes Pods to the network.
ClusterIP β Internal access only within the cluster.
NodePort β Exposes the service externally via
NodeIP:Port
.LoadBalancer β Integrates with cloud providers (AWS, GCP, Azure) to expose services externally with load balancing.
π οΈ Practical β Setting up Kubernetes on AWS EKS
For todayβs hands-on, weβll use Amazon Elastic Kubernetes Service (EKS) β a managed Kubernetes service.
Step 1: Install Prerequisites
# Install AWS CLI
sudo apt-get update && sudo apt-get install -y awscli
# Install eksctl (EKS cluster creation tool)
curl --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz
sudo mv eksctl /usr/local/bin
# Install kubectl
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/latest/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
Step 2: Create an EKS Cluster
eksctl create cluster \
--name devops-cluster \
--version 1.28 \
--region ap-south-1 \
--nodegroup-name devops-nodes \
--node-type t3.medium \
--nodes 2 \
--nodes-min 1 \
--nodes-max 3 \
--managed
This creates:
A Kubernetes cluster named devops-cluster
2 worker nodes in AWS
Step 3: Verify Cluster Connection
kubectl get nodes
kubectl cluster-info
You should see your EKS nodes ready. π
Step 4: Deploy a Sample App
# Create a deployment
kubectl create deployment myapp --image=nginx
# Expose it as a NodePort service
kubectl expose deployment myapp --type=NodePort --port=80
# Get the service details
kubectl get svc myapp
Now, access your app at http://<NodePublicIP>:<NodePort>
.
Step 5: Scale and Rollout
# Scale to 3 replicas
kubectl scale deployment myapp --replicas=3
# Check rollout status
kubectl rollout status deployment/myapp
# Update image (rolling update)
kubectl set image deployment/myapp nginx=nginx:1.21 --record
# Rollback if needed
kubectl rollout undo deployment/myapp
π― Kubernetes Interview Questions & Detailed Answers
Q1: What is the difference between Docker and Kubernetes?
π Docker is for building and running containers.
π Kubernetes is for managing containers across multiple hosts (scheduling, scaling, networking).
They complement each other, not replace.
Q2: What is a Pod in Kubernetes?
π A Pod is the smallest unit in Kubernetes, representing a running process.
Usually holds 1 container
Can hold multiple tightly coupled containers (e.g., a main app + sidecar container)
All containers inside a Pod share the same IP address, network, and storage.
Q3: How does Kubernetes ensure high availability?
π Kubernetes ensures HA by:
Maintaining the desired state via Deployments and ReplicaSets.
Rescheduling Pods to healthy nodes if a node crashes.
Distributing traffic via Services and Load Balancers.
Q4: What is the difference between ClusterIP, NodePort, and LoadBalancer?
ClusterIP β Default, internal-only, used for communication inside the cluster.
NodePort β Exposes app externally on a specific port across all nodes (
<NodeIP>:<Port>
).LoadBalancer β Integrates with cloud providers to automatically create an external load balancer.
Q5: How do rolling updates and rollbacks work in Kubernetes?
- Rolling Update: Replaces Pods gradually without downtime.
kubectl set image deployment/myapp nginx=nginx:1.21 --record
- Rollback: Reverts to the previous working version.
kubectl rollout undo deployment/myapp
β Takeaways from Day 27
Kubernetes is the industry standard for container orchestration.
Hands-on practice with Pods, Deployments, and Services gives you confidence for interviews.
Cloud-native DevOps roles almost always expect basic Kubernetes knowledge.
π‘ If youβre also preparing for DevOps interviews, letβs connect!
Iβll share more daily learnings + projects in this #30DaysOfDevOps journey.
#DevOps #Kubernetes #AWS #EKS #Cloud #SRE #InterviewPreparation
Subscribe to my newsletter
Read articles from Tathagat Gaikwad directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
