SuperAPI AI Directory

kind-dev

Deployment & operations

View repository

Updated 10-15 19:50

About this skill

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:

export CLUSTER_NAME="coder-k8s-${MUX_WORKSPACE_NAME:-dev}"

Bootstrap

./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:

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:

./hack/kind-dev.sh down
KIND_NODE_IMAGE=kindest/node:v1.32.0 ./hack/kind-dev.sh up

Start controller (out-of-cluster)

# 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

./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

k9s --context kind-${CLUSTER_NAME}

Cleanup

./hack/kind-dev.sh down

Validation when implementing

  1. Nix tools available:

    nix develop -c kubectl version --client
    nix develop -c kind version
    nix develop -c k9s version
    
  2. Script sanity:

    bash -n hack/kind-dev.sh
    
  3. Bootstrap smoke test (deterministic cluster name):

    CLUSTER_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
    
  4. Optional in-cluster controller smoke test:

    CLUSTER_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
    
  5. Skill file exists:

    test -f .mux/skills/kind-dev/SKILL.md
    
  6. Cleanup:

    CLUSTER_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.