Sleep Mode

The sleep mode feature in loft puts spaces or virtual clusters to sleep - either after a specified period of inactivity or manually triggered by a user. Spaces and virtual clusters automatically wake up when a user runs the first kubectl, helm or any other command using the space or virtual clusters. Users can also manually trigger the wake up process by clicking a button in the UI.

Virtual Clusters

Technically, virtual clusters do not have a sleep mode on their own. Instead, you can enable the sleep mode for the underlying namespace that the virtual cluster runs in. For convenience and easier understanding, the loft UI shows the sleep mode statistics for each virtual cluster but in fact the numbers reflect the sleep mode of the underlying space of each virtual cluster.

State Preservation

Note that when a space or virtual cluster goes to sleep, all persistent data as well as all Kubernetes objects will be preserved. Only the running containers will be terminated when the sleep mode starts. And these containers will be restarted once the space or virtual cluster wakes up again. Learn more about how sleep mode works.

Use Case & Benefits

While some of the spaces and virtual clusters that you manage with loft may contain production workloads which must run all day every day, there are many use cases where you want to create spaces and virtual clusters for development, testing, experimentation or CI/CD. These non-production workloads are usually just required to run when engineers are actually working with them. Considering a regular 40-hour work week, engineers work about 24% of the overall time per week:

40h work time / (24h per day * 7 days) total hours per week) ≈ 24%

And this calculation is not even including time for meetings, sick days, holidays etc. That means you can save more than 76% of your cloud infrastructure cost for idle namespaces or virtual clusters. Some namespaces and virtual clusters may even be running without any engineer touching them for weeks because we all know how the biggest downside of the cloud is that while it is easy to spin up things, no one ever shuts down anything without being forced to do so.

Sleep mode offers a fully automated solution for this problem. If your cluster is configured to horizontally auto-scale its nodes (which most public cloud providers allow you to enable with just a single click), you can save over 76% of infrastructure cost for your clusters by enabling sleep mode.


When putting a space or virtual cluster to sleep, loft looks up and saves the replica number for Deployments, StatefulSets, DaemonSets and other ReplicaSet based resources. Then, it scales down this replica number to 0 which triggers Kubernetes to delete all pods/containers.

With loft, you can:

Automatic For Entire Account

Cluster admins can enforce the sleep mode annotation for all spaces of a certain account to ensure that all spaces go to sleep after a certain period of inactivity.


Annotations set in the account settings cannot be overridden by the user when creating a space. The default RBAC set up by loft does not allow users to modify their namespaces after creation. If you add additional RBAC to allow users to update their namespaces, users will be able to deactivate or manually trigger sleep mode.

loft UI - Change Sleep Mode In Space Creation Settings

Automatic For Individual Spaces

loft UI - Change Sleep Mode For Space

Manual Sleep

loft UI - Manual Sleep & Wake-Up


When loft wakes up a space, it starts all pods/containers it has previously removed from the namespace. loft does this by changing the replica number for Deployments, StatefulSets, DaemonSets and other ReplicaSet based resources.

Automatic Wake-Up

loft is configured to wake up spaces automatically once they are being used. Using a space means to send any request to the Kubernetes API server involving any resources within the corresponding namespace. It does not matter if this request comes from running a kubectl command, a helm command or using any other tool, e.g.:

kubectl get po -n [NAMESPACE]

Manual Wake-Up

loft UI - Manual Sleep & Wake-Up

How does it work?

Sleep mode is configured by an annotation in the metadata of a Kubernetes namespace. There are two annotations you can use to configure sleep mode:

  • tells loft to trigger sleep mode automatically after x seconds1 of inactivity2
  • tells loft to manually start sleep mode for value true

loft will immediately detect changes to the sleep mode annotation and acts accordingly.

1 loft checks every space with an automatic sleep mode annotation in a fixed interval of 1 minute2 loft calculates the time of inactivity from the last request to the Kubernetes API server involving any resource within the namespace, e.g. `kubectl get pod -n my-namespace`, `helm install -n my-namespace`.