πŸš€ Beginner’s Guide to Installing Kubernetes (K8s) – Step by Step

Series: 30 Days DevOps Interview Preparation
Author: Tathagat Gaikwad

Kubernetes has become the de facto standard for container orchestration. Whether you’re preparing for DevOps interviews or setting up your own production-ready environment, you’ll need to know how to install Kubernetes correctly.

In this blog, we’ll cover:
βœ… What Kubernetes is (quick recap)
βœ… Prerequisites for installation
βœ… Kubernetes installation options (Minikube, Kind, AWS EKS)
βœ… Step-by-step setup (local & AWS)
βœ… Useful kubectl commands for beginners


πŸ”Ή What is Kubernetes?

Kubernetes (a.k.a. K8s) is an open-source platform designed to automate deploying, scaling, and managing containerized applications.

Think of Kubernetes as:
πŸ‘‰ Docker = Container runtime (how we package/run apps)
πŸ‘‰ Kubernetes = Container manager (how we schedule, scale, and heal apps across clusters).


πŸ”Ή Prerequisites for Kubernetes Installation

Before installing Kubernetes, make sure you have:

βœ… System Requirements

  • OS: Linux (Ubuntu/Debian), macOS, or Windows 10+

  • CPU: Minimum 2 cores (4 recommended)

  • RAM: Minimum 4GB (8GB recommended for EKS)

  • Disk: 20GB free space

βœ… Tools to Install

  1. Docker – Container runtime

  2. kubectl – Kubernetes command-line tool

  3. Minikube / Kind – For local clusters

  4. AWS CLI + eksctl – For AWS EKS setup

  5. Helm (optional) – Kubernetes package manager


πŸ”Ή Kubernetes Installation Methods

There are 3 common ways to install Kubernetes:

  1. Minikube β†’ Best for beginners (local single-node cluster).

  2. Kind (Kubernetes-in-Docker) β†’ Lightweight local cluster.

  3. AWS EKS (Elastic Kubernetes Service) β†’ Cloud-managed Kubernetes (production-ready).

We’ll cover Minikube (local) and EKS (cloud).


πŸ› οΈ Installing Kubernetes with Minikube (Local Setup)

Step 1: Install Docker

sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker

Step 2: Install kubectl

curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client

Step 3: Install Minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Step 4: Start Minikube Cluster

minikube start --driver=docker

Step 5: Verify Installation

kubectl get nodes

πŸ‘‰ Output should show 1 node ready. πŸŽ‰


πŸ› οΈ Installing Kubernetes on AWS EKS (Cloud Setup)

Step 1: Install Prerequisites

# AWS CLI
sudo apt-get install -y awscli

# eksctl
curl --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz
sudo mv eksctl /usr/local/bin

# 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 demo-cluster \
--region ap-south-1 \
--nodes 2 \
--node-type t3.medium \
--managed

Step 3: Verify Cluster

kubectl get nodes
kubectl cluster-info

Step 4: Deploy a Test App

kubectl create deployment hello-app --image=nginx
kubectl expose deployment hello-app --type=LoadBalancer --port=80
kubectl get svc hello-app

πŸ‘‰ Copy the external LoadBalancer URL β†’ paste in browser β†’ Your app is live on AWS EKS! πŸŽ‰


πŸ”Ή Useful kubectl Commands

# Get nodes and pods
kubectl get nodes
kubectl get pods

# Create a pod
kubectl run test-pod --image=nginx

# Scale deployment
kubectl scale deployment hello-app --replicas=3

# Rolling update
kubectl set image deployment/hello-app nginx=nginx:1.21

# Rollback
kubectl rollout undo deployment/hello-app

🎯 Interview Questions (with Answers)

Q1: Why do we need Minikube if we can use Docker directly?
πŸ‘‰ Docker runs containers on a single machine. Minikube simulates a Kubernetes cluster so you can practice orchestration.

Q2: What’s the difference between Minikube and AWS EKS?
πŸ‘‰ Minikube = local, single-node cluster for learning.
πŸ‘‰ EKS = cloud-managed, production-grade multi-node cluster.

Q3: Can we run Kubernetes without Docker?
πŸ‘‰ Yes. Kubernetes supports other runtimes like containerd and CRI-O.

Q4: What is the role of kubectl?
πŸ‘‰ kubectl is the CLI tool to interact with Kubernetes API server. You use it for creating pods, scaling, updating deployments, etc.


βœ… Key Takeaways

  • Kubernetes requires Docker, kubectl, and a cluster setup (Minikube or EKS).

  • Minikube is best for beginners, EKS is best for real-world, cloud-native workloads.

  • Understanding Pods, Deployments, and Services is essential for DevOps interviews.


#Kubernetes #DevOps #AWS #EKS #Minikube #Cloud #InterviewPreparation

0
Subscribe to my newsletter

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

Written by

Tathagat Gaikwad
Tathagat Gaikwad