Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

You know Docker. You’ve written Compose files. You’ve built images, connected containers, and mounted volumes.
Now your app needs to survive the real world — scaling, self-healing, zero-downtime deploys, secrets management, and multi-service coordination at scale.
That’s what this book teaches.


What You’ll Learn

By the end of this book, you’ll understand every major Kubernetes concept — from Pods to production security and internals — through hands-on labs, real-world examples, and deliberate “break it” exercises that build genuine debugging intuition.

The stack: Docker · Kubernetes (v1.28+) · Minikube · Helm · Prometheus & Grafana · ArgoCD · GitHub Actions


Prerequisites

You need these tools before starting. Run the check commands — if they pass, you’re good to go.

ToolVersionCheckExpected Output
Docker20+docker --versionDocker version 20.x...
kubectl1.28+kubectl version --clientClient Version: v1.28...
Minikube1.32+minikube versionminikube version: v1.3...
Helm3.xhelm versionversion.BuildInfo{Version:"v3...
Gitanygit --versiongit version 2...

Installation Guide

🐧 Linux (Ubuntu/Debian) Setup
# kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

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

# helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
🍎 macOS Setup

Install the tools using Homebrew:

# Install kubectl, minikube, and helm
brew install kubectl minikube helm

# Ensure Docker Desktop is installed and running
brew install --cask docker

Start Minikube with the Docker driver:

minikube start --driver=docker
🪟 Windows (WSL2) Setup

Ensure WSL2 and Docker Desktop for Windows (with WSL2 integration enabled) are installed.

Install using Chocolatey (in PowerShell as Administrator) or directly inside your WSL2 terminal:

# Chocolatey on Windows
choco install kubernetes-cli minikube kubernetes-helm

Or inside WSL2 (Ubuntu):

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

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

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Getting the Lab Files

Pre-built manifest YAML files for all hands-on exercises are available in the src/manifests/ directory, organized by chapter.

You can apply manifests directly from this directory during labs instead of manually copy-pasting code blocks:

# Example: Apply a manifest directly
kubectl apply -f src/manifests/ch03-pods/

How to Use This Book

Each chapter is designed to take 30–60 minutes and ends with a hands-on lab. The pattern is always:

Concept (short) → Example (immediate) → Try it → Break it
  • Read linearly if you’re new to Kubernetes.
  • Jump around if you have experience — every section is self-contained.
  • Do the labs. Reading about K8s is like reading about swimming. You have to get in the water.

🔥 The “Break It!” philosophy: The fastest way to understand a system is to watch it fail. Every chapter has intentional breakage exercises. Don’t skip them.

Chapter Dependency Map

graph LR
    CH1["Ch 1: Why K8s"] --> CH2["Ch 2: kubectl"]
    CH2 --> CH3["Ch 3: Pods"]
    CH3 --> CH4["Ch 4: Workloads"]
    CH3 --> CH5["Ch 5: Services"]
    CH5 --> CH6["Ch 6: Ingress"]
    CH3 --> CH7["Ch 7: Config"]
    CH3 --> CH8["Ch 8: Storage"]
    CH4 --> CH10["Ch 10: Health"]
    CH4 --> CH11["Ch 11: Resources"]
    CH4 --> CH12["Ch 12: Helm"]
    CH5 --> CH13["Ch 13: Observability"]
    CH3 --> CH14["Ch 14: Scheduling"]
    CH9["Ch 9: RBAC"] --> CH15["Ch 15: Security"]
    CH12 --> CH16["Ch 16: CI/CD"]
    CH3 --> CH17["Ch 17: Internals"]
    CH3 --> CH18["Ch 18: Troubleshooting"]

Arrows indicate prerequisite relationships. If you’re experienced with Kubernetes, use this graph to skip chapters you already know while ensuring you don’t miss a dependency.


Chapter Roadmap

#ChapterTimeYou’ll Be Able To
1The Container Orchestration Problem~45 minExplain why K8s exists and navigate a live cluster
2kubectl — Your Swiss Army Knife~40 minQuery and control any K8s resource from the CLI
3Pods — The Atomic Unit~50 minCreate, debug, and destroy pods with confidence
4Workload Controllers~55 minDeploy apps with zero-downtime rolling updates
5Services — Exposing Your Applications~45 minConnect pods across namespaces using DNS
6Ingress — HTTP Routing~50 minRoute external traffic with NGINX, Gateway API, and TLS
7ConfigMaps and Secrets~40 minExternalize config and manage sensitive data
8Storage — Persistent Data in K8s~45 minPersist data across pod restarts
9Namespaces, RBAC, and Multi-Tenancy~45 minPartition clusters and enforce least privilege
10Health Checks and Graceful Shutdown~45 minConfigure probes and graceful termination
11Resource Management and Autoscaling~50 minSet requests/limits and autoscale pods & clusters
12Helm — Package Management~55 minPackage, template, and manage releases with Helm & Kustomize
13Observability — Logging, Metrics, and Tracing~60 minSet up Prometheus, Grafana, and log aggregation
14Scheduling and Placement~50 minControl pod placement with affinity, taints, and tolerations
15Security Hardening~55 minLock down clusters with PSA, NetworkPolicies, and image scanning
16CI/CD and GitOps~55 minBuild automated delivery pipelines with GitHub Actions and ArgoCD
17Kubernetes Internals~60 minDeep dive into API machinery, etcd, CRI, CNI, and CSI
18Troubleshooting Playbook~55 minSystematic mental models and runbooks for any cluster failure

Ready? Let’s go to Chapter 1. →