KSail’s --ttl flag creates ephemeral clusters that auto-destroy after a specified duration. This is useful when you want to give yourself or others temporary access to a cluster — for debugging, demos, pair programming, or on-call investigation — without worrying about cleaning it up afterwards.
[!NOTE]
Automated CI tests don’t need --ttl — create the cluster, run tests, and delete it explicitly. See Testing in CI/CD for that pattern. However, --ttl can be added as a safety net in CI to auto-destroy clusters if the cleanup step is skipped (e.g. runner crash).
When you pass --ttl to ksail cluster create, KSail:
Creates the cluster normally.
Blocks the process, waiting for the TTL to elapse.
Auto-deletes the cluster when the timer expires.
Terminal window
# Create a cluster that auto-destroys after 2 hours
ksailclustercreate--ttl2h
Pressing Ctrl+C (or sending SIGINT/SIGTERM) cancels the TTL wait and leaves the cluster running. This lets you extend a session — just delete the cluster manually when you’re done.
[!IMPORTANT]
TTL deletion only runs while the ksail cluster create process is alive. If you close the terminal or kill the process, the cluster is not auto-deleted. Use ksail cluster delete to clean up manually.
Press Ctrl+C in the terminal running ksail cluster create --ttl .... The cluster stays running and you can continue using it. Delete it manually when you’re done:
KSail writes the kubeconfig context to the configured kubeconfig path (default ~/.kube/config, configurable via spec.cluster.connection.kubeconfig). Use kubectl, k9s, or ksail cluster connect immediately after creation. For context name formats per distribution, see Companion Tools.
For local Docker-based clusters, this typically means running on the same machine. For Talos clusters on Hetzner or Omni, the API server is network-accessible and the kubeconfig can be shared directly.
[!CAUTION]
Kubeconfig files contain cluster credentials (client certificates or tokens). Always share a minimal, context-specific kubeconfig rather than your full ~/.kube/config, use secure channels, and only share with trusted individuals. Note that your kubeconfig path may differ if you configured spec.cluster.connection.kubeconfig.
K3s starts fast and uses few resources for a full-workload cluster — good for quick debugging sessions where you need to run actual workloads.
Vanilla (Kind) provides standard upstream Kubernetes — useful when you need exact API compatibility.
Talos is immutable and secure — ideal for reproducing production-like environments.
VCluster uses the Vind Docker driver to run the control plane directly in Docker containers — no pre-existing host cluster required, useful for lightweight isolated environments.
KWOK starts in seconds and consumes minimal resources — ideal for control-plane testing and CI/CD pipelines that need a real Kubernetes API server without running actual workloads.
Use the ksail-cluster GitHub Actions composite action to set up KSail, cache Helm charts and mirror images, and run ksail project init + ksail cluster create in a single step. See PR Preview Clusters for the full action reference and GitOps CI workflows, or Testing in CI/CD for integration test patterns.