VCluster
VCluster creates lightweight, isolated virtual Kubernetes clusters that run as Docker containers. This guide walks you through creating your first VCluster, understanding when to use it, and exploring common use cases.
What is VCluster?
Section titled âWhat is VCluster?âVCluster provides virtual Kubernetes clustersâfully functional Kubernetes control planes that ordinarily run as pods inside a host Kubernetes cluster. KSail uses the Vind Docker driver to run VCluster directly on Docker instead, without requiring a host cluster. Each VCluster is isolated, starts in seconds, and shares Docker infrastructureâmaking it ideal for CI/CD and local multi-environment development.
When to Use VCluster
Section titled âWhen to Use VClusterâVCluster excels at CI/CD pipelines (ephemeral per-PR clusters, parallel test execution on shared runners), local multi-environment development (isolated environments per feature branch or team member), and learning (safe, disposable Kubernetes sandboxes).
Consider other distributions for production workloads (Talos), cloud deployment (Talos with Hetzner Cloud or Omni), standard upstream Kubernetes testing (Vanilla), low-resource devices (K3s), or advanced CNI control (Vanilla or Talos).
Quick Start
Section titled âQuick Startâ1. Initialize a VCluster Project
Section titled â1. Initialize a VCluster ProjectâCreate a new VCluster configuration:
mkdir my-vclustercd my-vcluster
ksail cluster init \ --name dev-cluster \ --distribution VCluster \ --gitops-engine FluxThis generates:
ksail.yamlâ KSail cluster configurationvcluster.yamlâ VCluster Helm values (native configuration)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, bootstraps the GitOps engine, and configures kubectl automatically.
3. Verify the Cluster
Section titled â3. Verify the Clusterâ# Check cluster infoksail cluster info
# List running containersdocker ps | grep dev-cluster
# Test kubectl accesskubectl get nodeskubectl get pods --all-namespaces4. Deploy an Application
Section titled â4. Deploy an Applicationâ# Create a simple deploymentkubectl create deployment nginx --image=nginx:1.25kubectl expose deployment nginx --port=80 --type=NodePort
# Check the servicekubectl get svc nginx5. Clean Up
Section titled â5. Clean Upâ# Delete the cluster when doneksail cluster delete
# Verify containers are removeddocker ps | grep dev-clusterConfiguration
Section titled âConfigurationâFor general KSail YAML options, see the Configuration Reference. Customize VCluster-specific behavior in vcluster.yaml:
# Control plane configurationcontrolPlane: distro: k3s: enabled: true statefulSet: resources: limits: memory: 2Gi requests: memory: 256Mi
# Sync options - what gets synced from virtual to hostsync: persistentVolumes: enabled: true storageClasses: enabled: true nodes: enabled: true
# Networkingnetworking: replicateServices: toHost: - from: default to: vcluster-defaultSee the vCluster configuration documentation for all options.
Common Use Cases
Section titled âCommon Use CasesâFor real-world VCluster workflow examples â CI/CD pipelines, multi-environment development, feature branch testing, and microservices isolation â see Use Cases.
Architecture
Section titled âArchitectureâVCluster runs a full Kubernetes control plane (API server, scheduler, controller manager, etcd) as pods inside a host Kubernetes cluster. In KSail, the Vind driver runs these components as Docker containers instead. Pods are scheduled onto cluster nodes (the control-plane node or optional worker nodes), each of which runs as a Docker container. When using host-cluster deployment mode, selected resources can be synced between the virtual and host cluster.
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 hangs or fails.
KSail automatically retries transient VCluster startup failures: up to 5 attempts (5-second delays) during create, and up to 3 attempts (3-minute timeout each) during the readiness check. Log messages like Retrying vCluster create (attempt 2/5)... are expected â wait for completion before investigating.
Persistent failures â common causes:
docker ps # Docker must be runninglsof -i :6443 # Check for port 6443 conflictsdocker info | grep -i memory # Ensure 2GB+ RAM allocated to DockerIf all retries fail, run ksail cluster delete && ksail cluster create.
kubectl Commands Fail
Section titled âkubectl Commands FailâSymptom: kubectl get nodes returns connection errors.
kubectl config current-context # Should show your VCluster namekubectl config use-context dev-cluster # Switch if neededIf the context is missing, delete and recreate the cluster.
Pod Scheduling Issues
Section titled âPod Scheduling IssuesâSymptom: Pods remain in Pending state.
kubectl describe pod <pod-name> # Check scheduling errorskubectl top nodes # Check resource availabilitykubectl get nodes # All nodes should show ReadySlow Performance
Section titled âSlow PerformanceâIncrease Docker resources (4 GB RAM, 2 CPUs minimum) in Docker Desktop settings, and delete unused clusters with ksail cluster list / ksail cluster delete.
Advanced Topics
Section titled âAdvanced TopicsâWorker Nodes
Section titled âWorker NodesâBy default, workload pods are scheduled onto the control-plane node, which runs as a Docker container. For more realistic multi-node scenarios, enable worker nodes:
nodes: enabled: true count: 3This creates separate Docker containers acting as worker nodes.
Custom Distributions
Section titled âCustom DistributionsâVCluster supports k3s (default), k8s, and k0s as internal distributions. Set controlPlane.distro.<name>.enabled: true in vcluster.yaml.
Resource Limits
Section titled âResource LimitsâControl resource consumption:
controlPlane: statefulSet: resources: limits: cpu: "1" memory: 2Gi requests: cpu: "100m" memory: 256Mi