Before you play with Kubernetes, you need a sandbox first. Can't learn to drive without a car, right?
- RAM: 8GB minimum, 16GB recommended
- CPU: Dual-core minimum, quad-core better
- Storage: 20GB free space
- OS: Windows 10/11, macOS, or Linux (any recent distro)
Why these specs? Kubernetes clusters consume resources. You'll run multiple containers simultaneously, plus the control plane coordinating everything.
Why do you need it?
Kubernetes orchestrates containers. You need a container runtime before orchestrating anything.
Install:
Windows/macOS:
- Download from docker.com/products/docker-desktop
- Install, restart computer if prompted
- Open Docker Desktop, wait until status shows "running"
Linux:
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker
sudo systemctl enable docker
# Add user to docker group so you don't need sudo
sudo usermod -aG docker $USER
# Logout and login againVerify:
docker --version
# Output: Docker version 24.x.x or newer
docker run hello-world
# If you see "Hello from Docker!" it's successfulWhy do you need it?
This is the command-line tool for communicating with Kubernetes clusters. Everything you do in K8s goes through kubectl.
Install:
Windows (PowerShell as Admin):
# Via Chocolatey (recommended)
choco install kubernetes-cli
# Or manual download
curl.exe -LO "https://dl.k8s.io/release/v1.28.0/bin/windows/amd64/kubectl.exe"
# Move kubectl.exe ke folder yang ada di PATHmacOS:
# Via Homebrew
brew install kubectl
# Or manual
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/Linux:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/Verify:
kubectl version --client
# Output: Client Version: v1.28.xWhy do you need it?
Production Kubernetes clusters are expensive and complex to set up. Minikube creates a local cluster on your laptop, perfect for learning.
Install:
Windows:
# Via Chocolatey
choco install minikube
# Or manual download
# https://minikube.sigs.k8s.io/docs/start/macOS:
brew install minikubeLinux:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikubeVerify:
minikube version
# Output: minikube version: v1.31.xNow you have all the tools. Time to spin up your first cluster:
# Start minikube cluster
minikube start
# Expected output:
# - Downloading Kubernetes components
# - Creating VM or container
# - Configuring environment
# - Done! kubectl is configuredTroubleshooting Start Issues:
Error: "Insufficient memory"
# Start with smaller resources
minikube start --memory=4096 --cpus=2Error: "Driver not found"
# Specify driver explicitly
minikube start --driver=docker
# or
minikube start --driver=virtualboxError on Windows: "Hyper-V required"
- Enable Hyper-V in Windows Features
- Or use Docker driver:
minikube start --driver=docker
After minikube starts successfully, try this:
# Check cluster status
minikube status
# Expected output:
# minikube
# type: Control Plane
# host: Running
# kubelet: Running
# apiserver: Running
# kubeconfig: Configured# Check nodes
kubectl get nodes
# Expected output:
# NAME STATUS ROLES AGE VERSION
# minikube Ready control-plane 1m v1.28.xIf you see output like that, congratulations. You have a Kubernetes cluster running on your laptop.
When you ran minikube start, here's what happened:
- VM/Container Created - Minikube creates a lightweight VM or container to run the cluster
- Kubernetes Components Started - Control plane components (API server, scheduler, controller manager) are started
- kubectl Configured - Config file created at
~/.kube/configso kubectl knows how to connect - Node Ready - One node (named "minikube") is ready to accept workloads
Analogy: You just set up a personal data center on your laptop. Small, yes, only one "server", but it's a fully functional Kubernetes cluster.
# Stop cluster (ga delete data)
minikube stop
# Start lagi cluster yang udah ada
minikube start
# Delete cluster completely
minikube delete
# SSH into the minikube VM
minikube ssh
# Open Kubernetes dashboard (web UI)
minikube dashboard
# Check minikube IP
minikube ipCreate a folder to store YAML files and experiments:
mkdir -p ~/k8s-learning
cd ~/k8s-learning
# Test by creating a simple namespace
kubectl create namespace test
kubectl get namespacesk9s is a terminal UI for Kubernetes. More user-friendly than pure kubectl commands.
Install:
# macOS
brew install k9s
# Linux
curl -sS https://webinstall.dev/k9s | bash
# Windows
choco install k9sUsage:
k9s
# Press '0' to show all namespaces
# Use arrow keys to navigate
# Press 'd' to describe resource
# Press 'l' to see logs
# Press ':q' to quitBefore moving to Chapter 1, make sure you can:
-
docker --versionshows installed version -
kubectl version --clientshows installed version -
minikube versionshows installed version -
minikube startsucceeds without errors -
kubectl get nodesshows one node in Ready status -
minikube dashboardopens web UI (optional but good for visual learners)
Solution:
minikube delete
minikube start --driver=docker --alsologtostderr
# Check logs for specific errorsSolution: Make sure kubectl is in PATH. Test:
which kubectl # macOS/Linux
where kubectl # Windows
# If not found, re-install and add to PATHSolution:
# Add user to docker group
sudo usermod -aG docker $USER
# Logout and login againSetup complete? Time to actually use Kubernetes.
Go to: Chapter 1: First Contact
In the next chapter, you'll:
- Deploy your first application to the cluster
- Understand what a Pod is
- Interact with running containers in Kubernetes
Estimated time: 30-60 minutes (including downloads)
Difficulty: Easy
Can you skip this?: No. Everything else depends on this.