KIND dev clusters (coder-k8s)
Load this skill only when you need a real Kubernetes cluster (KIND) during development or demos.
Unique cluster names (parallel agents)
Prefer a per-workspace name to avoid collisions:
bash
export CLUSTER_NAME="coder-k8s-${MUX_WORKSPACE_NAME:-dev}"
Bootstrap
bash
./hack/kind-dev.sh up
kubectl --context kind-${CLUSTER_NAME} get nodes
./hack/kind-dev.sh up defaults to KIND_NODE_IMAGE=kindest/node:v1.34.0. Override it when needed:
bash
KIND_NODE_IMAGE=kindest/node:v1.32.0 ./hack/kind-dev.sh up
If the cluster already exists and you change KIND_NODE_IMAGE, recreate it first:
bash
./hack/kind-dev.sh down KIND_NODE_IMAGE=kindest/node:v1.32.0 ./hack/kind-dev.sh up
Start controller (out-of-cluster)
bash
# up already switches your current context; run ctx again if needed. ./hack/kind-dev.sh ctx GOFLAGS=-mod=vendor go run . --app=controller
Optional: in-cluster controller
bash
./hack/kind-dev.sh load-image
kubectl --context kind-${CLUSTER_NAME} apply -f config/e2e/deployment.yaml
kubectl --context kind-${CLUSTER_NAME} -n coder-system wait --for=condition=Available deploy/coder-k8s --timeout=120s
Demo with k9s
bash
k9s --context kind-${CLUSTER_NAME}
Cleanup
bash
./hack/kind-dev.sh down
Validation when implementing
- •
Nix tools available:
bashnix develop -c kubectl version --client nix develop -c kind version nix develop -c k9s version
- •
Script sanity:
bashbash -n hack/kind-dev.sh
- •
Bootstrap smoke test (deterministic cluster name):
bashCLUSTER_NAME=coder-k8s-dev ./hack/kind-dev.sh up test "$(kubectl config current-context)" = "kind-coder-k8s-dev" kubectl --context kind-coder-k8s-dev get crd codercontrolplanes.coder.com kubectl --context kind-coder-k8s-dev get clusterrole manager-role kubectl --context kind-coder-k8s-dev -n coder-system get sa coder-k8s
- •
Optional in-cluster controller smoke test:
bashCLUSTER_NAME=coder-k8s-dev ./hack/kind-dev.sh load-image kubectl --context kind-coder-k8s-dev apply -f config/e2e/deployment.yaml kubectl --context kind-coder-k8s-dev -n coder-system wait --for=condition=Available deploy/coder-k8s --timeout=120s
- •
Skill file exists:
bashtest -f .mux/skills/kind-dev/SKILL.md
- •
Cleanup:
bashCLUSTER_NAME=coder-k8s-dev ./hack/kind-dev.sh down
Use explicit kubectl --context kind-${CLUSTER_NAME} commands whenever possible to avoid acting on the wrong cluster.