Skip to main content

Command Palette

Search for a command to run...

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

Published
4 min read

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

  1. Pod → The smallest deployable unit in Kubernetes. A Pod usually runs one container, but can run multiple tightly coupled containers.

  2. Deployment → Ensures that the right number of Pods are running. Provides rolling updates and rollbacks.

  3. ReplicaSet → Maintains a stable set of replicas (Pods).

  4. 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

More from this blog

Cloud Enthusiast

116 posts