Overview

  • Study notes from two books:
    • Kubernetes Cookbook by Sébastien Goasguen & Michael Hausenblas (O’Reilly, 2018): ~70 recipes in Problem → Solution → Discussion form.
    • Kubernetes Best Practices by Brendan Burns, Eddie Villalba, Dave Strebel & Lachlan Evenson (O’Reilly, 2019): distilled into one checklist note, Best Practices.
  • Everything is modernised to Kubernetes 1.31+. The Cookbook was written for Kubernetes ~1.7–1.10, so plenty has changed. Look for the Changed since the book callouts.
  • Each recipe is condensed into Problem / Solution / Discussion / Gotchas, with its source recipe number.
  • These notes build on my existing Kubernetes notes rather than repeat them:

Biggest Changes Since 2018 (cheat sheet)

Then (book)Now
kubectl run creates a Deploymentkubectl run = one Pod. Use kubectl create deployment
extensions/v1beta1, apps/v1beta1/2apps/v1 (with a required selector)
Ingress extensions/v1beta1, serviceNamenetworking.k8s.io/v1, pathType, ingressClassName, + Gateway API
CronJob batch/v2alpha1batch/v1 (+ timeZone)
HPA autoscaling/v1 + Heapsterautoscaling/v2 + metrics-server
PodSecurityPolicyPod Security Admission (namespace labels)
Helm 2 + TillerHelm 3, no Tiller, OCI charts
hand-rolled overlaysKustomize built into kubectl (apply -k)
client-side applykubectl apply --server-side
Docker Engine as node runtimecontainerd / CRI-O (dockershim removed 1.24)
SA token Secrets auto-createdShort-lived projected tokens, kubectl create token
CRD v1beta1 (no validation, defaults or subresources)apiextensions.k8s.io/v1 with schema, CEL rules, conversion
exec with curl to debugkubectl debug with ephemeral containers
Katacoda, minikube + VirtualBox, ACS, kubicorn, kubelessKillercoda, kind / minikube (Docker) / k3d, AKS, Cluster API, Knative

Study Order

  1. Getting Started & Local Clusters: get a kind or minikube cluster running.
  2. Learning kubectl: get comfortable with get/describe/explain/apply/delete.
  3. API, Namespaces & Labels: how manifests and metadata work.
  4. Creating & Modifying Workloads: Deployments, rollouts, Jobs, CronJobs, DaemonSets, StatefulSets.
  5. Services & Ingress: networking and exposure.
  6. Volumes & Configuration: ConfigMaps, Secrets, PVCs.
  7. Monitoring & Logging: probes, logs, metrics.
  8. Scaling: HPA, VPA, node autoscaling.
  9. Security: ServiceAccounts, RBAC, Pod Security, NetworkPolicy, Secrets in Git.
  10. Managing Manifests: Helm, Kustomize, server-side apply, GitOps.
  11. Maintenance & Troubleshooting: debugging, drain, etcd.
  12. Extending Kubernetes: CRDs, operators, admission policies.
  13. Best Practices: the production checklist that ties it all together.

All Recipes

NoteRecipeOne-liner
Getting Started & Local Clusters1.1Try K8s in a browser sandbox (Killercoda)
Getting Started & Local Clusters1.2Install kubectl (brew / dl.k8s.io), keep within ±1 minor
Getting Started & Local Clusters1.3 / 1.4minikube start, addons, docker-env, image load
Getting Started & Local Clusters1.5First app: create deployment + expose
Getting Started & Local Clusters1.6GUI: minikube dashboard → Headlamp / k9s
Getting Started & Local Clusters2.1 / 2.2kubeadm init/join + containerd + a CNI
Getting Started & Local Clusters2.3 – 2.6Release binaries, static Pods, kubelet under systemd
Getting Started & Local Clusters2.7 / 2.8Managed clusters: GKE, AKS (was ACS), EKS
Learning kubectl3.1get, short names, -A, api-resources
Learning kubectl3.2delete by name/label/file, cascades, finalizers
Learning kubectl3.3-w, watch, rollout status, kubectl wait
Learning kubectl3.4edit, set, patch, scale, and why edits drift
Learning kubectl3.5kubectl explain for field docs
Creating & Modifying Workloads4.1Deployment from the CLI
Creating & Modifying Workloads4.2apply -f file/dir/URL
Creating & Modifying Workloads4.3A Pod manifest from scratch
Creating & Modifying Workloads4.4A Deployment manifest (apps/v1)
Creating & Modifying Workloads4.5Rolling update, history, undo, restart
Services & Ingress5.1Expose a Deployment with a Service
Services & Ingress5.2Verify Service DNS
Services & Ingress5.3Change Service type (NodePort, LoadBalancer)
Services & Ingress5.4Install an Ingress controller
Services & Ingress5.5Ingress networking.k8s.io/v1 (+ Gateway API extra)
API, Namespaces & Labels6.1Discover API groups and versions
API, Namespaces & Labels6.2Anatomy of a manifest
API, Namespaces & Labels6.3Namespaces against name collisions
API, Namespaces & Labels6.4ResourceQuota + LimitRange
API, Namespaces & Labels6.5 / 6.6Labels and selectors
API, Namespaces & Labels6.7Annotations and change-cause
Creating & Modifying Workloads7.1Job (with TTL cleanup)
Creating & Modifying Workloads7.2CronJob batch/v1
Creating & Modifying Workloads7.3DaemonSet per node
Creating & Modifying Workloads7.4StatefulSet + headless Service
Creating & Modifying Workloads7.5Init containers (+ native sidecars)
Volumes & Configuration8.1Share files via emptyDir
Volumes & Configuration8.2Secrets (and why base64 ≠ encryption)
Volumes & Configuration8.3ConfigMaps as env vars or files
Volumes & Configuration8.4Static PV + PVC
Volumes & Configuration8.5 / 8.6Dynamic provisioning with StorageClasses
Scaling9.1kubectl scale
Scaling9.2 / 9.3Node autoscaling (Cluster Autoscaler, Karpenter)
Scaling9.4HPA autoscaling/v2 (+ VPA extra)
Security10.1ServiceAccounts and bound tokens
Security10.2kubectl auth can-i, inspect roles
Security10.3Role + RoleBinding (least privilege)
Security10.4securityContext + Pod Security Admission (+ NetworkPolicy extra)
Monitoring & Logging11.1kubectl logs (incl. --previous)
Monitoring & Logging11.2 – 11.4Liveness, readiness, startup probes
Monitoring & Logging11.5metrics-server + kubectl top (was Heapster)
Monitoring & Logging11.6Prometheus via kube-prometheus-stack
Monitoring & Logging11.7Central logging (Fluent Bit → Loki/OpenSearch)
Maintenance & Troubleshooting12.1kubectl autocompletion
Services & Ingress12.2Relabel a Pod out of a Service
Services & Ingress12.3Reach a ClusterIP Service (port-forward, proxy)
Maintenance & Troubleshooting12.4Parse status with jsonpath and kubectl wait
Maintenance & Troubleshooting12.5Debug Pods (statuses table, kubectl debug)
Maintenance & Troubleshooting12.6cluster-info dump snapshot
Maintenance & Troubleshooting12.7Add worker nodes (kubelet, containerd, kube-proxy)
Maintenance & Troubleshooting12.8cordon/drain/uncordon + PDBs
Maintenance & Troubleshooting12.9etcd v3 snapshots
Extending Kubernetes13.1 / 13.2Build K8s from source (make WHAT=)
Extending Kubernetes13.3Python client
Extending Kubernetes13.4CRDs apiextensions.k8s.io/v1 (+ operators, admission extras)
Managing Manifests14.1Install Helm 3 (no Tiller)
Managing Manifests14.2Install charts, upgrade, rollback
Managing Manifests14.3Create and package your own chart
Managing Manifests14.4Compose → K8s with kompose (+ Kustomize, SSA, GitOps extras)
Extending Kubernetes14.5Clusters as code (kubicorn → Cluster API/eksctl)
Security14.6Encrypted Secrets in Git (Sealed Secrets, ESO, SOPS)
Extending Kubernetes14.7Functions (kubeless → Knative/OpenFaaS/KEDA)
Best PracticesBP Ch. 1–17The production checklist

Summary

  • 12 topic notes + 1 Best Practices checklist, covering every Cookbook recipe (1.1–14.7) with modern APIs and tools.
  • Start with local clusters and kubectl, then workloads → networking → config → observability → scaling → security → packaging → ops → extending.
  • Rule of thumb throughout: declarative YAML in Git, current API versions, least privilege, and probes + resources on everything.