Lesson 7 of 16
Tear down the lab
When you're done for the day — or when something gets weird and you want a fresh start — you stop the lab in three steps. The whole point of keeping everything inside ~/incident-cluster/ was to make this trivial.
What we're stopping (and what we're keeping)
| Stop | Keep |
|---|---|
| The kind cluster (3 node containers) | The Homebrew tools (kind, kubectl, helm in /opt/homebrew/bin/) |
The kubectl port-forward listening on :8080 |
The Istio release in ~/incident-cluster/istio-1.29.X/ (so istioctl still works) |
| Docker Desktop's VM | Your manifests: kind-incident.yaml, bookinfo-gateway.yaml |
Anything inside the cluster (Istio, Bookinfo, the demo namespace, all pods) |
The PATH line you added to ~/.zshrc |
The tooling stays installed. Re-running the lab later is just cd ~/incident-cluster plus the cluster-create + manifest-apply commands from the previous lessons.
1. Stop the port-forward
If the terminal where you ran kubectl port-forward is still open, press Ctrl-C there and you're done.
If you can't find that terminal — or you backgrounded the command — kill whatever is bound to :8080:
lsof -ti:8080 | xargs kill 2>/dev/null
Verify nothing is still listening:
lsof -i :8080
No output means the port is free. If you see a stray process, kill -9 <PID> it.
2. Delete the cluster
kind delete cluster --name incident-lab
This removes the three node containers, the kind-incident-lab entry from your kubeconfig, and everything that lived inside the cluster (Istio control plane, Bookinfo deployments, the demo namespace, all secrets and CRDs). The cluster's etcd state goes with it.
Confirm:
docker ps --filter "name=incident-lab" # no rows
kubectl config get-contexts | grep incident # no rows
3. Shut down Docker Desktop
Docker Desktop runs a Linux VM in the background and reserves a few GB of RAM for it even when no containers are running. Once the cluster is deleted, quit Docker Desktop to give that memory back to your laptop:
- Click the Docker whale icon in the macOS menu bar → Quit Docker Desktop
- Or from a shell:
osascript -e 'quit app "Docker"'
Verify the VM is gone:
docker info
Should error with Cannot connect to the Docker daemon — exactly the same error we warned about in lesson 04, but this time it's the desired state, not a problem to fix.
Coming back next time
When you want the lab back:
Start Docker Desktop.
cd ~/incident-cluster.Re-run the create + apply steps from lessons 05 and 06:
kind create cluster --config kind-incident.yaml kubectl apply -n demo \ -f https://raw.githubusercontent.com/istio/istio/release-1.29/samples/bookinfo/platform/kube/bookinfo.yaml istioctl install --set profile=demo -y kubectl create namespace demo kubectl label namespace demo istio-injection=enabled kubectl apply -f bookinfo-gateway.yaml kubectl -n istio-system port-forward svc/istio-ingressgateway 8080:80The node, Istio, and Bookinfo images are still in Docker's image cache, so the cluster comes up in seconds rather than minutes.
Truly clean slate (only if you want it)
If you don't plan to come back to the lab and want to reclaim disk:
rm -rf ~/incident-cluster # ~200 MB Istio release + your manifests
docker image prune -a # ~3 GB cached node + Bookinfo + Istio images
This forces a re-pull and re-download next time — equivalent to starting lesson 04 from scratch. The Homebrew tools (kind, kubectl, helm) stay put either way.