Kubernetes Labs
Learn Kubernetes from first pod to production platform: workloads, networking, storage, scaling, security, delivery, operators, and cost.
The first 24 labs run on a local kind cluster (installed) or k3d. Labs 25–32 then rebuild the environment as a parity copy of your VPS — Ubuntu 20.04, 4 vCPU / 5.8 GB, host nginx on 80/443, Docker/Coolify, the Grafana/Loki stack, SQLite/Postgres, backups — on a disposable VM. Labs 33–34 go deep on operators, ending with a VpsApp operator that deploys your actual app pattern.
The VPS is not a lab target: it already runs Docker, nginx, Coolify and monitoring, and a k3s install there competes for 4 vCPU / 5.8 GB and the same ports. A disposable VM running k3s is the "real node" lab.
Start here: labs/lab-01-cluster-and-kubectl-fundamentals/
Cluster provisioning with Terraform + Ansible is covered in undefined. This track focuses on the objects, operations, security and delivery on top of the cluster.
Prerequisites
| Tool | Why | Note |
|---|---|---|
| Docker | cluster nodes as containers | installed |
kind | default local cluster | installed |
kubectl | API client | v1.37.1 installed |
helm | packaging labs | installed |
kustomize | overlay labs | v5.8.1 installed |
k3d or Multipass | optional multi-node / k3s | install if needed |
| Go 1.22+ | operator lab (20) | same upgrade as the provider track |
stern, k9s | quality of life | optional |
Recommended local resources: 4 CPU / 8 GB RAM free for a 3-node kind cluster plus the observability stack. If you have less, use one node and reduce replicas.
Learning path
| Stage | Labs | Outcome |
|---|---|---|
| 1. Core objects | 01–06 | Deploy, expose, configure, persist, and debug an app |
| 2. Operate & scale | 07–11 | Scheduling, autoscaling, reliability, observability, failure analysis |
| 3. Security | 12–16 | RBAC, pod hardening, network policy, supply chain, admission policy |
| 4. Delivery | 17–19 | Helm, Kustomize, GitOps |
| 5. Advanced | 20–23 | Operators in Go, upgrades/etcd, multi-tenancy/cost, networking internals |
| 6. Capstone | 24 | A platform you can defend |
| 7. VPS parity | 25–32 | Inventory, parity cluster, strangler migration, real apps, observability, backup/DR, security, capacity/cost |
| 8. Operator depth | 33–34 | Webhooks/conversion/lifecycle, then a VpsApp operator capstone |
Lab index
| # | Lab | Level | Focus |
|---|---|---|---|
| 01 | Cluster and kubectl fundamentals | Beginner | kind, contexts, namespaces, API objects |
| 02 | Workloads and rollouts | Beginner | Deployments, probes, rollout/rollback |
| 03 | Services and DNS | Beginner | ClusterIP, NodePort, headless, CoreDNS |
| 04 | Ingress and TLS | Intermediate | ingress-nginx, cert-manager, host/path routing |
| 05 | Config and secrets | Intermediate | ConfigMaps, Secrets, env/volume, external secrets |
| 06 | Storage and StatefulSets | Intermediate | PV/PVC, StorageClass, stable identity, backup |
| 07 | Scheduling, limits and QoS | Intermediate | requests/limits, affinity, taints, PDB |
| 08 | Autoscaling: HPA, VPA, KEDA | Advanced | Metrics, scale-in safety, event-driven |
| 09 | Reliability, probes and disruption | Advanced | Probes, PDB, drain, graceful shutdown |
| 10 | Observability and SLOs | Advanced | Prometheus, Grafana, Loki, burn-rate alerts |
| 11 | Debugging and failure modes | Advanced | CrashLoop, OOM, Pending, image pulls, DNS |
| 12 | RBAC and ServiceAccounts | Advanced | Least privilege, token projection, audit |
| 13 | Security context and Pod Security | Advanced | non-root, seccomp, capabilities, PSA |
| 14 | NetworkPolicy and CNI | Advanced | Default deny, selectors, CNI behaviour |
| 15 | Supply chain security | Advanced | Trivy, cosign, SBOM, admission verification |
| 16 | Policy as code with Kyverno | Advanced | Validate, mutate, generate, exceptions |
| 17 | Helm charts | Intermediate | Chart anatomy, values, hooks, tests, OCI |
| 18 | Kustomize and environments | Intermediate | Bases, overlays, patches, promotion |
| 19 | GitOps with Argo CD or Flux | Advanced | Sync, drift, waves, rollback |
| 20 | Operators and CRD development | Expert | Go, controller-runtime, reconcile, finalizers |
| 21 | Cluster upgrades and etcd backup | Expert | Version skew, drain, snapshot, restore |
| 22 | Multi-tenancy and cost | Expert | Quotas, LimitRange, priority, OpenCost |
| 23 | Kubernetes networking deep dive | Expert | CNI, kube-proxy, eBPF, CoreDNS, MTU |
| 24 | Capstone: production platform | Expert | Everything, documented and defended |
| 25 | VPS service inventory and migration map | Advanced | Read-only audit, keep/move decisions |
| 26 | VPS parity cluster | Advanced | Ubuntu 20.04 + 4 vCPU / 5.8 GB + host nginx |
| 27 | Host-nginx strangler migration | Advanced | Keep 80/443, proxy to k3s, canary |
| 28 | Run the VPS apps on Kubernetes | Advanced | Portfolio, Mizan, open-webui, API, data |
| 29 | Observability stack parity | Advanced | Prometheus/Loki/Grafana within budget |
| 30 | Backup and DR parity | Advanced | Velero/restic, Floci, restore drill |
| 31 | Security parity | Advanced | Control-by-control VPS mapping |
| 32 | Capacity and cost parity | Advanced | Allocatable, QoS, cost per app |
| 33 | Operator webhooks and lifecycle | Expert | Defaulting, validation, conversion, upgrades |
| 34 | Capstone: VpsApp operator | Expert | One CR to a production app stack |
Non-negotiables
- Never install k3s on the production VPS without a disposable parity VM and an explicit rollback plan. Ports 80/443/6443 and Docker are already in use. Labs 25–32 use a 4 vCPU / 6 GB Ubuntu 20.04 VM that mimics the VPS; only read-only inspection touches the real host.
- Always set requests and limits. A pod without them is a future incident and a cost leak.
- Health is not "the pod is Running". Define readiness, liveness and startup behaviour deliberately.
- Default deny for NetworkPolicy and RBAC; add back only what is proven necessary.
- Pin images by digest in anything you call production.
- Tear down clusters and volumes at the end of each lab; local clusters are cheap only when they are stopped.
Workspace convention for your code
~/iac-work/kubernetes/
├── clusters/kind/
├── apps/<app>/{base,overlays}
├── charts/<chart>/
├── policies/
├── gitops/
└── operators/<name>/
Do not put implementation code inside this curriculum folder.
- 01Lab 01 — Cluster and kubectl fundamentals
- 02Lab 02 — Workloads and rollouts
- 03Lab 03 — Services and DNS
- 04Lab 04 — Ingress and TLS
- 05Lab 05 — Config and secrets
- 06Lab 06 — Storage and StatefulSets
- 07Lab 07 — Scheduling, limits and QoS
- 08Lab 08 — Autoscaling: HPA, VPA, KEDA
- 09Lab 09 — Reliability: Probes, PDBs and Disruption
- 10Lab 10 — Observability and SLOs
- 11Lab 11 — Debugging and Failure Modes
- 12Lab 12 — RBAC and Service Accounts
- 13Lab 13 — Security Context and Pod Security
- 14Lab 14 — Network Policies and CNI
- 15Lab 15 — Supply Chain Security
- 16Lab 16 — Policy as Code with Kyverno
- 17Lab 17 — Helm Charts and Release Lifecycle
- 18Lab 18 — Kustomize and Environment Promotion
- 19Lab 19 — GitOps with Argo CD and Flux
- 20Lab 20 — Operators and CRD Development
- 21Lab 21 — Cluster Upgrades and etcd Backup
- 22Lab 22 — Multi-Tenancy and Cost Control
- 23Lab 23 — Kubernetes Networking Deep Dive
- 24Lab 24 — Capstone: Production Platform
- 25Lab 25 — VPS Service Inventory and Migration Map
- 26Lab 26 — VPS Parity Cluster
- 27Lab 27 — Host nginx Strangler Migration
- 28Lab 28 — Run VPS Apps on Kubernetes
- 29Lab 29 — Observability Stack Parity
- 30Lab 30 — Backup and DR Parity
- 31Lab 31 — Security Parity
- 32Lab 32 — Capacity and Cost Parity
- 33Lab 33 — Operator Webhooks and Lifecycle
- 34Lab 34 — Capstone: VpsApp Operator