Skip to main content
Version: v4.11

Manage namespace sleep and auto-delete

Enterprise
Available in these plansFreeDevProdScale
Auto Sleep for Namespaces

Free, Dev, Prod, and Scale are vCluster Platform license plans. Open source does not need a license or a Platform connection. See Compare open source and free tiers.

vClustervClusterAn open-source software product that creates and manages tenant clusters within Kubernetes infrastructure. vCluster provides tenant isolation capabilities while reducing infrastructure costs.Related: Tenant cluster, Control plane cluster Platform can put an idle namespace to sleep by scaling down its workloads. It retains workload-controller definitions and restores their replicas when the namespace wakes. The platform can also delete namespaces after an inactivity period.

Standalone Pods

Sleep deletes Pods that no workload controller manages. Kubernetes can't restore these Pods during wakeup.

Put a namespace to sleep​

  1. Select the project that contains the namespace.
  2. Click Namespaces in the sidebar.
  3. Open the namespace's actions, then click Sleep.
  4. Optionally select Prevent automatic wake up and enter a duration in hours. Enter 0 to prevent automatic wakeup indefinitely.
  5. Click Ok.

To perform the same operation with the CLI, run:

vcluster platform sleep namespace <namespace-name> --project <project-name>

Add --prevent-wakeup <seconds> to block activity-based wakeup for a period. Use --prevent-wakeup 0 to require a manual wakeup.

Wake a namespace​

Open the sleeping namespace's actions, click Wake Up, then confirm the wakeup. You can also run:

vcluster platform wakeup namespace <namespace-name> --project <project-name>

Unless wakeup is prevented, a Kubernetes API request routed through the platform can wake the namespace automatically. Supported Ingress, Istio, and Gateway API traffic can also trigger wakeup.

Configure auto sleep​

  1. Select the project that contains the namespace.
  2. Click Namespaces in the sidebar.
  3. Click Edit for the namespace.
  4. Expand Sleep Mode.
  5. Set Sleep After Inactivity, Sleep Schedule, Wake up Schedule, and Schedule timezone as needed.
  6. Click Save Changes.

For a namespace created from a template, edit the template instead of the instance.

Configure auto-delete​

Auto-delete permanently deletes a namespace after an inactivity period. It is separate from sleep and can run whether the namespace is awake or sleeping.

Edit the namespace, expand Sleep Mode, and set Delete After Inactivity. Configure the value in the template for template-created namespaces.

Activity detection​

Kubernetes API requests routed through vCluster Platform count as namespace activity. This includes kubectl requests when the kubeconfig routes through the platform proxy.

The platform can also detect supported Ingress, Istio, and Gateway API traffic. These integrations and the last-activity update interval work the same way for namespaces and tenant clusters. See activity detection and wakeup for the shared behavior and agent configuration.

Exclude workloads​

Add sleepmode.loft.sh/exclude: "true" to a Deployment, StatefulSet, ReplicaSet, or Pod to leave its existing Pods running while the namespace sleeps. See Exclude workloads from auto sleep for the quota behavior and a full example.

Filter activity and long-running connections​

Add request-filter annotations, including sleepmode.loft.sh/ignore-active-connections, to the namespace. See filter platform activity and handle long-running connections for the shared configuration. The platform annotation reference lists every supported filter and value format.