Overview

  • Chapters 1 and 2 of the Kubernetes Cookbook: how to get a cluster to play with, from a browser sandbox to a laptop cluster to a cloud-managed one.
  • Back to the hub: Kubernetes Cookbook · Big picture: Kubernetes · CLI basics: Kubectl
  • Rule of thumb in 2026: learn on a local cluster (kind, minikube, k3d), deploy to a managed one (GKE, EKS, AKS). Hand-built clusters (kubeadm) are for learning the internals or for on-prem.

Changed since the book (2018 → Kubernetes 1.31+)

  • Katacoda shut down in 2022, so use Killercoda or Play with Kubernetes instead.
  • minikube no longer needs VirtualBox. It defaults to the Docker driver (or podman, qemu, vfkit on macOS).
  • Docker Engine is no longer the node runtime. dockershim was removed in 1.24, and nodes now run containerd or CRI-O. Images built with Docker still run fine because they’re standard OCI images. See docker.
  • kubectl run now creates a single Pod, not a Deployment (since 1.18). Use kubectl create deployment.

Choosing a Local Cluster

ToolRuns asBest forStart command
kindNodes are Docker containersCI, multi-node tests, throwaway clusterskind create cluster
minikubeVM or containerLearning, built-in add-ons (ingress, metrics-server, dashboard)minikube start
k3dk3s in DockerVery light, fast startupk3d cluster create dev
Docker Desktop / OrbStack / Rancher DesktopBuilt into the desktop app”Just a tick-box”Settings → enable Kubernetes

Recipes

Recipe 1.1 — Try Kubernetes Without Installing Anything

  • Problem: You want to poke at Kubernetes with zero setup.
  • Solution: Use a browser sandbox: the interactive tutorials on kubernetes.io, Killercoda, or Play with Kubernetes. Sessions are temporary (roughly an hour).
  • Gotchas: Nothing persists, so treat it as a scratchpad.

Source: K8s Cookbook, Recipe 1.1

Recipe 1.2 — Install kubectl

  • Problem: You need the CLI to talk to any cluster.
  • Solution:
# macOS
brew install kubectl
 
# Linux (official binary)
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -m 0755 kubectl /usr/local/bin/kubectl
 
kubectl version --client
  • Discussion: Keep kubectl within ±1 minor version of the API server (the “version skew” policy).
  • Gotchas: Docker Desktop also ships a kubectl. Run which -a kubectl if versions look odd.

Changed since the book:

The download URL moved from storage.googleapis.com/kubernetes-release to dl.k8s.io.

Source: K8s Cookbook, Recipe 1.2

Recipe 1.3 / 1.4 — Run and Use minikube Locally

  • Problem: You want a real single-node (or multi-node) cluster on your laptop.
  • Solution:
brew install minikube
minikube start --cpus=4 --memory=8g --kubernetes-version=stable
kubectl get nodes                  # context "minikube" is selected for you
 
minikube ip | ssh | stop | delete  # everyday sub-commands
minikube addons list               # ingress, metrics-server, dashboard…
eval $(minikube docker-env)        # build images straight into minikube's runtime
minikube image load myapp:dev      # …or push a local image into the cluster
  • Discussion: docker-env (or minikube image load) saves you from pushing images to a registry during dev. With kind, the equivalent is kind load docker-image myapp:dev.
  • Gotchas: If you use :latest with a locally loaded image, set imagePullPolicy: IfNotPresent. Otherwise Kubernetes tries to pull from Docker Hub and fails.

Changed since the book:

minikube ≥ 1.x picks the Docker driver automatically, and --memory accepts units (8g). You can also run multi-node with minikube start --nodes 3.

Source: K8s Cookbook, Recipes 1.3 & 1.4

Recipe 1.5 — Start Your First Application

  • Problem: The cluster is up and you want something running and reachable.
  • Solution:
kubectl create deployment ghost --image=ghost:5 --port=2368
kubectl expose deployment ghost --port=2368 --type=NodePort
kubectl get pods -w
minikube service ghost          # opens the NodePort in your browser
# (kind/k3d alternative) kubectl port-forward deploy/ghost 2368:2368
  • Discussion: create deployment and expose are imperative generators. They write the YAML for you. For anything you keep, generate the YAML and commit it: kubectl create deployment ghost --image=ghost:5 --dry-run=client -o yaml > ghost.yaml.
  • Gotchas: Old blog posts say kubectl run ghost … creates a Deployment. It doesn’t anymore, so nothing would recreate that Pod if it died. See Deployments.

Changed since the book:

kubectl run = bare Pod only. --dry-run must now be --dry-run=client (or =server).

Source: K8s Cookbook, Recipe 1.5

Recipe 1.6 — A GUI for the Cluster

  • Problem: You want a point-and-click view of Deployments, ReplicaSets and Pods.
  • Solution: minikube dashboard still works for a quick look. For a maintained desktop/web UI use Headlamp (a Kubernetes SIG UI project). Terminal fans use k9s.
  • Discussion: A GUI is great for seeing the Deployment → ReplicaSet → Pod chain from Deployments. Create things with YAML, not clicks.

Changed since the book:

The upstream Kubernetes Dashboard project has been archived. Headlamp is now the suggested replacement. Never expose a dashboard publicly with a cluster-admin token.

Source: K8s Cookbook, Recipe 1.6

Recipe 2.1 / 2.2 — Bootstrap a Cluster with kubeadm

  • Problem: You want a “real” multi-machine cluster on your own VMs or bare metal.
  • Solution (on every node):
    1. Install a container runtime (containerd), and turn swap off (or configure kubelet’s swap support).
    2. Add the pkgs.k8s.io repo for your minor version and install kubelet kubeadm kubectl.
    3. On the control plane: sudo kubeadm init --pod-network-cidr=10.244.0.0/16.
    4. Copy /etc/kubernetes/admin.conf to ~/.kube/config.
    5. Install a CNI plugin (Cilium, Calico or Flannel). Nodes stay NotReady until you do.
    6. On each worker, run the printed command: kubeadm join <cp-ip>:6443 --token <t> --discovery-token-ca-cert-hash sha256:<h>.
  • Discussion: kubeadm is the standard building block that many installers wrap. It runs the control plane as static Pods (see 2.6).
  • Gotchas: Tokens expire after 24h. Make a new one with kubeadm token create --print-join-command.

Changed since the book:

apt.kubernetes.io / packages.cloud.google.com are gone, so use pkgs.k8s.io. Don’t apt-get install docker.io as the runtime. Weave Net is discontinued, so pick Cilium, Calico or Flannel. kubeadm is GA, no longer “beta”.

Source: K8s Cookbook, Recipes 2.1 & 2.2

Recipe 2.3 – 2.6 — Release Binaries, hyperkube and systemd

  • Problem: You want to understand what a cluster is made of, binary by binary.
  • Solution / what’s still true:
    • Release binaries live at https://dl.k8s.io/<version>/…. Always verify the published SHA256, and the signatures, which releases now carry (cosign).
    • The kubelet is the only component that has to be a systemd service. kubeadm writes /lib/systemd/system/kubelet.service plus a drop-in at /etc/systemd/system/kubelet.service.d/10-kubeadm.conf.
    • The kubelet watches /etc/kubernetes/manifests/ and runs any Pod YAML it finds there as a static Pod. That’s how etcd, kube-apiserver, kube-controller-manager and kube-scheduler run on kubeadm clusters: Kubernetes runs itself.
  • Gotchas: Static Pods show up in kubectl get pods -n kube-system as mirror pods. Deleting them via kubectl does nothing; edit the file on the node instead.

Changed since the book:

The hyperkube all-in-one image was removed (1.19). Images moved from gcr.io/google_containers / k8s.gcr.io to registry.k8s.io. The insecure API port (--insecure-port=8080) no longer exists. For the “learn every piece by hand” route, see Kubernetes the Hard Way.

Source: K8s Cookbook, Recipes 2.3 – 2.6

Recipe 2.7 / 2.8 — Managed Clusters (GKE, AKS, EKS)

  • Problem: You want a production-grade control plane without running it yourself.
  • Solution:
# Google GKE (Autopilot = Google also manages nodes)
gcloud container clusters create-auto demo --region=europe-west1
gcloud container clusters get-credentials demo --region=europe-west1
 
# Azure AKS
az group create -n k8s -l northeurope
az aks create -g k8s -n demo --node-count 2 --generate-ssh-keys
az aks get-credentials -g k8s -n demo
 
# AWS EKS
eksctl create cluster --name demo --region eu-west-1 --nodes 2
  • Discussion: The control plane (API server, etcd) is invisible to you, so you can’t SSH to it or touch etcd. You pay per cluster-hour plus nodes.
  • Gotchas: Delete when done (gcloud container clusters delete, az group delete -n k8s, eksctl delete cluster). Forgotten clusters are a classic surprise bill.

Changed since the book:

Azure ACS was retired, so az acs … is now az aks …. GKE gained Autopilot. For EKS, eksctl is the usual CLI.

Source: K8s Cookbook, Recipes 2.7 & 2.8


Summary

  • Local: kind / minikube / k3d. Cloud: GKE / AKS / EKS. DIY: kubeadm + containerd + a CNI.
  • kubectl run = Pod, kubectl create deployment = Deployment. Generate YAML with --dry-run=client -o yaml.
  • Control-plane components on kubeadm clusters are static Pods in /etc/kubernetes/manifests.
  • Nodes run containerd/CRI-O, not Docker, but your Docker-built images work unchanged.