Tool · Open source
KubeDrill: practice kubectl. No cluster required.
KubeDrill simulates a Kubernetes cluster on your machine. You work with the real kubectl, learn commands and resources and hunt down injected faults in challenges – without setting up a cluster.
$ kubedrill start $ kubectl --context kubedrill create deployment nginx --image=nginx:1.27 $ kubectl --context kubedrill get deployments,pods NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/nginx 1/1 1 1 4s NAME READY STATUS RESTARTS AGE pod/nginx-574fbc9564-ssvv7 1/1 Running 0 4s $ kubedrill challenge start image-pull-backoff $ kubectl --context kubedrill get pods NAME READY STATUS RESTARTS AGE nginx-574fbc9564-ssvv7 1/1 Running 0 8s nginx-7ff4b6c78d-vqsmz 0/1 ImagePullBackOff 0 5s
Using it in six steps
All output on this page comes from a real run of KubeDrill v0.1.0 on Ubuntu 24.04. Pod names and times will differ on your machine.
1 · Install and check
Install KubeDrill with brew, apt or dnf (see Install). You also need kubectl. Afterwards kubedrill doctor checks the setup; before the first start the server and context are still missing, which is expected:
$ kubedrill doctor
[ok ] kubectl found in PATH /usr/local/bin/kubectl
Client Version: v1.37.2
[FAIL] KubeDrill server running
-> run `kubedrill start`
[FAIL] context "kubedrill" present in /home/ubuntu/.kube/config
-> run `kubedrill kubeconfig merge` or use `kubedrill kubectl`
current-context: kind-werkzeuge
2 · Start the simulator
kubedrill start runs the simulated cluster in the background and adds a kubedrill context to your kubeconfig. Your current context stays as it was – kind-werkzeuge in this example.
$ kubedrill start
KubeDrill started: simulated Kubernetes v1.37.2 on https://127.0.0.1:16443 (pid 1413790)
Standalone kubeconfig: /home/ubuntu/.kubedrill/kubeconfig
Added context "kubedrill" to /home/ubuntu/.kube/config (current-context: kind-werkzeuge).
Try:
kubectl --context kubedrill get nodes
kubedrill challenge list
3 · Point kubectl at the simulator
Because your current context is not switched, you tell kubectl where to go. Three ways, the first is the safest:
# 1. Pass the context with every command (recommended) kubectl --context kubedrill get nodes # 2. Wrapper: always goes to the simulator, never to a real cluster kubedrill kubectl get pods # 3. Switch for good – remember to switch back later kubectl config use-context kubedrill
$ kubectl --context kubedrill get nodes
NAME STATUS ROLES AGE VERSION
kubedrill-control-plane Ready control-plane 1s v1.37.2
kubedrill-worker Ready <none> 1s v1.37.2
kubedrill-worker2 Ready <none> 1s v1.37.2
Tip to save typing: put alias kd='kubectl --context kubedrill' into your shell configuration, then kd get pods is enough.
4 · Practise as on a real cluster
Pods, Deployments, Services, Ingress, ConfigMaps and Secrets behave as in real Kubernetes: rollouts, rollbacks, endpoints, events. An image tag that does not exist ends in ImagePullBackOff, just like for real.
$ kubectl --context kubedrill create deployment web --image=nginx:1.27 --replicas=3 --port=80 $ kubectl --context kubedrill expose deployment web --port=80 $ kubectl --context kubedrill set image deployment/web nginx=nginx:1.28 $ kubectl --context kubedrill rollout status deployment/web $ kubectl --context kubedrill rollout undo deployment/web $ kubectl --context kubedrill run kaputt --image=nginx:9.99 $ kubectl --context kubedrill get pods NAME READY STATUS RESTARTS AGE kaputt 0/1 ImagePullBackOff 0 5s
Anything that would need a running process is refused with a clear message:
$ kubectl --context kubedrill exec nginx -- ls
error: unable to upgrade connection: exec is not available in the simulator: containers are
simulated and no processes run. Use 'kubectl logs', 'kubectl describe' and 'kubectl get events'
to inspect workloads.
5 · Solving a challenge
Challenges inject a fault into the cluster. You find it with kubectl, fix it and have the result checked. The next section shows the whole flow.
6 · Stop, resume, start over
$ kubedrill stop KubeDrill stopped (pid 1413790). State saved to /home/ubuntu/.kubedrill/state.json. The "kubedrill" context stays in your kubeconfig for the next start; `kubedrill kubeconfig remove` deletes it. $ kubedrill start # everything is back $ kubedrill reset Simulated cluster reset: all workloads, challenge state and events were removed.
stop saves the state, start restores it. reset deletes everything you created and your challenge progress.
A challenge step by step
Using service-selector as the example: the pods are running, but the Service cannot find them.
-
Look at the list and start a challenge. Without an ID the first unsolved one starts.
$ kubedrill challenge list ID DIFFICULTY MIN STATUS TITLE crashloop-missing-env beginner 10 CrashLoopBackOff: the API exits right after starting image-pull-backoff beginner 10 Rollout stuck: the new image cannot be pulled missing-configmap beginner 8 CreateContainerConfigError: missing ConfigMap service-selector beginner 8 Service without endpoints ingress-wrong-port intermediate 10 Ingress returns 503: backend port mismatch pending-resources intermediate 10 Pending forever: insufficient resources readiness-probe intermediate 12 Running but never Ready: failing readiness probe $ kubedrill challenge start service-selector Challenge started: Service without endpoints [beginner] ID: service-selector The pods of "shop-frontend" are Running and Ready, but requests to the Service "shop-frontend" in namespace "default" fail: nobody answers. Find out why the Service does not route traffic and fix it. Run `kubedrill challenge check` when done.
MIN is the estimated duration in minutes.
-
Investigate – with plain kubectl. The Service has no endpoints:
$ kubectl --context kubedrill get endpoints shop-frontend NAME ENDPOINTS AGE shop-frontend <none> 0s -
Stuck? Hints are graded; each call shows the next one.
kubedrill challenge statusshows the task, the hints and the current state of the success criteria.$ kubedrill hint Hint 1/3: A Service forwards traffic to its endpoints. Look at them: `kubectl get endpoints shop-frontend` (or `kubectl describe service shop-frontend`). Still stuck? `kubedrill hint` shows hint 2. -
Find the cause and fix it. Here: a typo in the Service selector.
$ kubectl --context kubedrill get svc shop-frontend -o jsonpath='{.spec.selector}' {"app":"shop-frontnd"} $ kubectl --context kubedrill get pods --show-labels NAME READY STATUS RESTARTS AGE LABELS shop-frontend-5b8cc996bf-j8lg8 1/1 Running 0 8s app=shop-frontend,... $ kubectl --context kubedrill patch svc shop-frontend -p '{"spec":{"selector":{"app":"shop-frontend"}}}' service/shop-frontend patched
-
Have it checked. The cluster state is evaluated, not the commands you used – any correct fix counts.
$ kubedrill challenge check Success criteria: [x] Service shop-frontend has both frontend pods as ready endpoints (2 ready endpoint(s)) [x] Deployment shop-frontend is still available (replicas=2 updated=2 available=2 desired=2) Solved! Well done – you fixed it on your own (1 hint(s) used). -
End the challenge. The cluster returns to its state before the challenge; with
--keepit stays as it is.$ kubedrill challenge stop Challenge "service-selector" ended: solved on your own. The cluster was restored to the state before the challenge.
Got stuck?
kubedrill challenge resetrestores the broken starting point if you went down the wrong path. Hints already revealed stay visible.kubedrill solveshows the diagnosis, root cause, fix and the matching commands. The cluster is not changed – you type the fix yourself, and the result counts as “completed with help”.
All commands
| Command | What it does |
|---|---|
| kubedrill start | Start the simulator in the background and add the kubedrill context |
| kubedrill stop | Stop the simulator and save its state |
| kubedrill status | Show address, process, kubeconfig and the active challenge |
| kubedrill doctor | Check kubectl, server and kubeconfig |
| kubedrill reset | Empty the cluster: delete your resources and challenge progress |
| kubedrill kubectl … | kubectl that is guaranteed to talk only to the simulator |
| kubedrill challenge list | All challenges with difficulty, duration and status |
| kubedrill challenge start [id] | Start a challenge (without an ID: the first unsolved one) |
| kubedrill challenge status | Task, hints and the state of the success criteria |
| kubedrill hint [--level N] | Show the next hint or a specific one |
| kubedrill challenge check | Check the result (exit code 1 while unsolved) |
| kubedrill challenge reset | Restore the broken starting point of the challenge |
| kubedrill solve | Show the solution without changing the cluster |
| kubedrill challenge stop [--keep] | End the challenge and restore the previous state (or keep it) |
| kubedrill challenge validate DATEI | Validate your own scenario files |
| kubedrill kubeconfig remove | Remove the kubedrill context from the kubeconfig |
| kubedrill version | Print versions |
Useful options for kubedrill start: --port (a port other than 16443), --fresh (start without the saved state), --image-check=off (fully offline), --set-current-context (switch the context right away), --scenarios DIR (your own challenges).
Troubleshooting
- kubectl shows my real cluster instead of the simulator.
- Your current context is a different one. Add
--context kubedrill, usekubedrill kubectlor switch withkubectl config use-context kubedrill.kubectl config current-contextshows where commands go. kubedrill kubectlrejects--context.- On purpose: the wrapper always talks to the simulator only and rejects options such as
--context,--kubeconfigor--server, so a real cluster is never hit by accident. - Port 16443 is already in use.
- Start on a different port, for example
kubedrill start --port 17443. Thekubedrillcontext is updated to match. - I have no internet connection.
- Start with
kubedrill start --image-check=off. KubeDrill then does not check image tags online; everything else works offline anyway. exec,port-forwardortopdo not work.- No processes run in the simulator. Use
logs,describeandget events– the same tools you use to find real faults. - I want to remove everything.
- Run
kubedrill stop, thenkubedrill kubeconfig remove, and uninstall the package. The~/.kubedrillfolder holds state, keys and backups of your kubeconfig and can be deleted afterwards.
Your own challenges
A challenge is a YAML file: task, starting state, injected fault, success criteria and hints. Put it in ~/.kubedrill/scenarios/ or start with --scenarios DIR; kubedrill challenge validate checks it beforehand. Scenario guide
-
01
Real kubectl
You type the same kubectl commands as on a real cluster: get, describe, logs, apply, edit, patch, scale, rollout. KubeDrill only plays the cluster behind them.
-
02
No cluster required
No control plane, no etcd, no containers, no Docker, no VM. A single binary for macOS and Linux, started with kubedrill start.
-
03
Faults to find
Challenges inject realistic faults: ImagePullBackOff, CrashLoopBackOff, a broken Service selector, an Ingress pointing to the wrong port. Hints come step by step.
-
04
The result is what counts
kubedrill challenge check evaluates the state of the cluster, not the commands you typed. Any correct fix counts.
-
05
Your real clusters stay untouched
The simulator listens on 127.0.0.1 only. It adds its own kubedrill context to your kubeconfig and never changes your current context.
-
06
Works offline
No image is ever pulled or run. The only network traffic is anonymous requests checking that an image tag exists – and with --image-check=off not even those.
Challenges
Seven faults are built in. You can write your own scenarios in YAML, without any Go code.
| ID | Level | Fault |
|---|---|---|
| image-pull-backoff | Beginner | Deployment points to an image tag that does not exist; the rollout is stuck |
| crashloop-missing-env | Beginner | App exits because DATABASE_URL is missing |
| service-selector | Beginner | Typo in the Service selector, no endpoints |
| missing-configmap | Beginner | Reference to a missing ConfigMap → CreateContainerConfigError |
| readiness-probe | Intermediate | Readiness probe on a path that returns 404; Running but 0/1 |
| pending-resources | Intermediate | Memory requests larger than any node → Pending |
| ingress-wrong-port | Intermediate | Ingress backend points to a Service port that does not exist |
Install
For macOS and Linux, amd64 and arm64. You also need kubectl; kubedrill doctor checks your setup.
# macOS (Homebrew)
brew install itdrills/tap/kubedrill
# Debian / Ubuntu (apt)
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://itdrills.github.io/kubedrill/gpg.key \
| sudo gpg --dearmor -o /etc/apt/keyrings/kubedrill.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubedrill.gpg] https://itdrills.github.io/kubedrill/deb stable main" \
| sudo tee /etc/apt/sources.list.d/kubedrill.list
sudo apt update
sudo apt install kubedrill
# Fedora / RHEL / Rocky / Alma (dnf)
sudo curl -fsSL -o /etc/yum.repos.d/kubedrill.repo https://itdrills.github.io/kubedrill/kubedrill.repo
sudo dnf install kubedrill
# then
kubedrill start
kubectl --context kubedrill get nodes
Updates arrive with brew upgrade, apt upgrade or dnf upgrade. The package repositories are signed. Binary with checksum and building from source: Installation page · Releases
What the simulator can't do
- Nothing runs: there is no exec, port-forward, cp or top, and logs are synthetic.
- Networking is simulated: Services have endpoints, but no traffic flows and there is no DNS.
- Not there yet: StatefulSet, DaemonSet, Job, PVC, RBAC, NetworkPolicy, CRDs.
For everything that needs real pods, a real network and real nodes, there are the courses – there you work on a real cluster. Install Kubernetes locally
KubeDrill v0.1.0
Free and open source under the Apache License 2.0. Feedback and challenge ideas are welcome as an issue on GitHub.