Local Cluster Setup
Use kind to provide a local Kubernetes cluster for development and integration tests. Keep its kubeconfig separate from other clusters.
Contents
- Prerequisites
- Step 1: Install tools
- Step 2: Create a cluster
- Step 3: Verify access
- Existing clusters
- Cleanup
Prerequisites
- A running container runtime supported by kind, such as Docker.
- Permission to create containers and download node images.
Step 1: Install tools
On macOS with Homebrew:
brew install kind kubectlFor other platforms, follow the official kind installation instructions and kubectl installation instructions .
kind version
kubectl version --clientStep 2: Create a cluster
Choose an unused cluster name and kubeconfig path:
mkdir -p "$HOME/.kube"
kind create cluster --name gpustack-dev \
--kubeconfig "$HOME/.kube/gpustack-kind.yaml" --wait 120sThis uses kind’s default node image. Record the actual server version when testing.
Step 3: Verify access
kubectl --kubeconfig "$HOME/.kube/gpustack-kind.yaml" \
--context kind-gpustack-dev --request-timeout=15s cluster-info
kubectl --kubeconfig "$HOME/.kube/gpustack-kind.yaml" \
--context kind-gpustack-dev --request-timeout=15s get nodes -o wideProvide the kubeconfig path and context name to the local test runner. Keep the file private and out of Git.
Existing clusters
Export an existing cluster’s kubeconfig to an unused file:
kind get kubeconfig --name gpustack-dev > "$HOME/.kube/gpustack-kind.yaml"Then verify access using the preceding commands.
Cleanup
The cluster owner removes the cluster when testing is complete:
kind delete cluster --name gpustack-dev \
--kubeconfig "$HOME/.kube/gpustack-kind.yaml"