Skip to content

Ephemeral Clusters with --ttl

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.

When you pass --ttl to ksail cluster create, KSail:

  1. Creates the cluster normally.
  2. Blocks the process, waiting for the TTL to elapse.
  3. Auto-deletes the cluster when the timer expires.
Terminal window
# Create a cluster that auto-destroys after 2 hours
ksail cluster create --ttl 2h

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.

ScenarioExampleSuggested TTL
Debugging a failing deploymentSpin up a cluster, deploy the broken app, inspect logs and state--ttl 1h
Demo or walkthroughShow a feature to a colleague or stakeholder--ttl 30m
Pair programmingShare a cluster with a teammate for a focused session--ttl 2h
On-call investigationReproduce a production issue in a local cluster--ttl 1h
Learning / experimentationTry out a new Helm chart or CRD--ttl 1h
PR reviewSpin up a cluster to manually verify a pull request--ttl 30m
Terminal window
ksail cluster create --ttl 1h

The process blocks and prints a message:

ℹ cluster will auto-destroy in 1h0m0s (press Ctrl+C to cancel)

When the timer expires, KSail automatically deletes the cluster and exits.

While the cluster is running, you can check the TTL status from another terminal:

Terminal window
ksail cluster info

This appends TTL information to the standard cluster info output, showing the remaining time. You can also see TTL status in the cluster list:

Terminal window
ksail cluster list

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:

Terminal window
ksail cluster delete

If you want to keep using your terminal while the TTL timer runs, background the process:

Terminal window
ksail cluster create --ttl 2h &

The cluster creates normally and the TTL countdown runs in the background. When the timer expires, the cluster is auto-deleted.

KSail writes the kubeconfig context to the configured kubeconfig path (defaults to ~/.kube/config, configurable via spec.cluster.connection.kubeconfig) during cluster creation. You can use kubectl, k9s, or any other Kubernetes tool immediately.

The context name depends on the distribution:

DistributionContext name
Vanilla (Kind)kind-<name>
K3s (K3d)k3d-<name>
Talosadmin@<name>
VClustervcluster-docker_<name>

To connect with K9s for interactive debugging:

Terminal window
ksail cluster connect

To share a running ephemeral cluster with a colleague on the same network, they need:

  1. A minimal kubeconfig for the specific cluster context
  2. Network access to the cluster’s API server

Export only the relevant context to avoid leaking unrelated clusters or credentials:

Terminal window
kubectl config view --minify --flatten --context k3d-ksail > /tmp/ksail-kubeconfig.yaml

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.

Choose a TTL based on how long you expect to need the cluster, plus some buffer:

Session typeRecommended TTL
Quick check (< 15 min)--ttl 30m
Debugging session--ttl 1h
Extended investigation--ttl 2h
Workshop or demo--ttl 4h

Set the TTL to roughly 2× your expected session length — long enough that you won’t be interrupted, short enough that forgotten clusters don’t waste resources.

  • K3s starts fastest and uses the fewest resources — good for quick debugging sessions.
  • 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.
  • Use Cases — Workflows for learning, development, and CI/CD
  • Companion Tools — Pair KSail with Tilt, Skaffold, or mirrord
  • Configuration — Complete configuration reference