Run a practice cluster on your computer
In this task you'll practise Kubernetes without paying for a cluster.
kind (Kubernetes in Docker) runs a real Kubernetes cluster as containers on your own computer. Each container plays one node, so you get a control plane and worker nodes for free, and you can delete and rebuild the whole cluster in a minute.
It's perfect for learning and for breaking things on purpose. It isn't for production: everything lives on one machine, and some cloud features (managed load balancers, managed identities) aren't there. minikube is a similar option.
Example. Tollmere Logistics' new platform engineers each run a three-node kind cluster on their laptops. They practise drains, evictions and broken pods there before touching the shared AKS clusters.
Before you start
You need: Docker Desktop and kind on your computer (both free). Time: 20 minutes.
Where to look
- Terminal
- kind
- kubectl
Steps
- Install Docker Desktop, kind and kubectl from their official sites, and start Docker Desktop.
- Save a
kind.yamlwith onecontrol-planenode and twoworkernodes. - Run
kind create cluster --name lab --config kind.yamland wait for it to finish. - Run
kubectl get nodesand check all three nodes show Ready. - When you've finished, run
kind delete cluster --name lab.
Commands
# kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
# then
kind create cluster --name lab --config kind.yaml
kubectl get nodes -o wide
kubectl config current-context
Watch out for
- Cost
- Free: it runs on your computer. Give Docker Desktop at least 4 GB of memory for three nodes.
- Security
- Practise clusters are for practice: never copy production secrets into them.
- Common mistakes
- Forgetting which context kubectl is pointing at, and running practice commands against a real cluster. Check with
kubectl config current-context.
Clean up
Run kind delete cluster --name lab.
Words to know
- kind
- Kubernetes in Docker: runs each cluster node as a container, for local practice and CI.
- kubeconfig
- The file kubectl reads to know which cluster to talk to and how to sign in.
- Context
- A named cluster, user and namespace in your kubeconfig; switching context switches cluster.
Tick off each step and track your progress in the guide.
Open this task in DevOps, Hands On