KWOK
KWOK creates ultra-fast simulated Kubernetes clusters for control-plane-level testing. This guide walks you through creating your first KWOK cluster, understanding when to use it, and exploring common use cases.
What is KWOK?
Section titled âWhat is KWOK?âKWOK (Kubernetes WithOut Kubelet) is a toolkit that enables simulating thousands of Kubernetes nodes and pods without running actual containers. KSail uses kwokctlâs Docker runtime to run etcd, kube-apiserver, and the kwok-controller as Docker containers. Nodes and pods are simulated at the API level â they appear Ready and Running but consume no compute resources.
When to Use KWOK
Section titled âWhen to Use KWOKâKWOK excels at control-plane testing (validating API operations, RBAC, and admission webhook configuration â webhook objects are accepted by the API server, but in-cluster webhook execution is not supported because no real pod serves the endpoint), CI/CD speed optimization (clusters start in seconds with minimal resource usage), scale testing (simulate thousands of nodes/pods without real infrastructure), and tooling validation (testing kubectl, Helm, and GitOps workflows against a real API server).
Consider other distributions for workloads that need real containers (Vanilla, K3s), production-grade immutable infrastructure (Talos), or isolated virtual clusters (VCluster).
Quick Start
Section titled âQuick Startâ1. Initialize a KWOK Project
Section titled â1. Initialize a KWOK ProjectâCreate a new KWOK configuration:
mkdir my-kwok-clustercd my-kwok-cluster
ksail cluster init \ --name dev-cluster \ --distribution KWOK \ --gitops-engine ArgoCDThis generates:
ksail.yamlâ KSail cluster configurationkwok.yamlâ KWOK simulation CRDs (ClusterLogs, ClusterExec, ClusterAttach, ClusterPortForward)k8s/kustomization.yamlâ Directory for Kubernetes manifests
2. Create the Cluster
Section titled â2. Create the Clusterâksail cluster createKSail creates Docker containers for the control plane (etcd, kube-apiserver, kwok-controller), configures simulation CRDs, and sets up kubectl automatically.
3. Verify the Cluster
Section titled â3. Verify the Clusterâ# Check cluster infoksail cluster info
# List running containersdocker ps | grep kwok
# Test kubectl accesskubectl get nodeskubectl get pods --all-namespaces4. Deploy an Application
Section titled â4. Deploy an Applicationâ# Create a deployment â pods are simulated as Runningkubectl create deployment nginx --image=nginx:1.25kubectl get pods -w # Pods transition to Running via KWOK Stage simulation
# Logs work via ClusterLogs CRDkubectl logs deploy/nginx5. Clean Up
Section titled â5. Clean Upâksail cluster deleteConfiguration
Section titled âConfigurationâFor general KSail YAML options, see the Configuration Reference. The kwok.yaml file contains KWOK-specific CRDs that enable simulation of kubectl operations:
# KWOK cluster simulation configuration.# These CRDs enable kubectl logs, exec, attach, and port-forward for simulated pods.---apiVersion: kwok.x-k8s.io/v1alpha1kind: ClusterLogsmetadata: name: default-logsspec: logs: - logsFile: /dev/null---apiVersion: kwok.x-k8s.io/v1alpha1kind: ClusterExecmetadata: name: default-execspec: execs: - local: {}---apiVersion: kwok.x-k8s.io/v1alpha1kind: ClusterAttachmetadata: name: default-attachspec: attaches: - {}---apiVersion: kwok.x-k8s.io/v1alpha1kind: ClusterPortForwardmetadata: name: default-port-forwardspec: forwards: - {}See the KWOK documentation for all available CRDs and configuration options.
How KWOK Simulation Works
Section titled âHow KWOK Simulation WorksâKWOK provides default Stage configurations that automatically transition pods and nodes:
- Nodes: Transition to
Readystatus immediately - Pods: Transition through
PendingâRunningâSucceededlifecycle
The kwok.yaml scaffolded by KSail adds four Cluster-level CRDs not provided by default:
- ClusterLogs: Enables
kubectl logsto return configurable output - ClusterExec: Enables
kubectl execto run commands - ClusterAttach: Enables
kubectl attach - ClusterPortForward: Enables
kubectl port-forward
All Kubernetes API operations (create, get, describe, delete, scale, apply) work against the real API server. Helm charts install and their pods appear Running. GitOps controllers are deployed and simulated as Running, but ksail workload reconcile is skipped for KWOK â controllers cannot actually sync resources because their container processes are not running.
Comparison with Other Distributions
Section titled âComparison with Other DistributionsâFor a full comparison across all distributions and supported components, see the Support Matrix.
Troubleshooting
Section titled âTroubleshootingâCluster Wonât Start
Section titled âCluster Wonât StartâSymptom: ksail cluster create fails.
docker ps # Docker must be runningdocker info # Ensure Docker daemon is healthykubectl Commands Fail
Section titled âkubectl Commands FailâSymptom: kubectl get nodes returns connection errors.
kubectl config current-context # Should show kwok-<cluster-name>kubectl config use-context kwok-dev-cluster # Switch if neededPods Not Transitioning to Running
Section titled âPods Not Transitioning to RunningâSymptom: Pods stay in Pending state.
This typically means KWOKâs Stage configurations are missing. Ensure kwok.yaml is present or recreate the cluster:
ksail cluster deleteksail cluster init --distribution KWOKksail cluster create