Skip to main content
Version: 1.26

Garbage Collector

The Okteto Garbage Collector helps keep your infra costs under control by sleeping or deleting inactive environments.

Sleeping Resources

The Okteto Garbage Collector automatically scales inactive applications to zero if they haven't been used for longer than the sleep period to automatically save resources in your cluster. Learn how to configure this in the configuration steps.

Additionally, Namespaces can be manually scaled to zero by navigating to Admin -> Namespaces and clicking on the three dots on the right side of the Namespace that you wish to sleep.

wake a sleeping resource

Inactive Applications and Resources

Okteto considers an application inactive if a user hasn't performed any of the following tasks during the sleep period. The following events are considered activity that will prevent an application from being marked as inactive or will wake a sleeping namespace:

  • Deploying a Kubernetes Deployment or StatefulSet with kubectl or similar tools
  • Running okteto deploy
  • Running okteto up
  • Maintaining an active okteto up session. If the upSessionByLastSyncedFile setting is enabled, this only counts if files are actively being synced (based on the last synced file)
  • Upgrade or redeploy via the UI or the command line

Service accounts, config maps, secrets, or volumes you create will be unaffected by the sleep operation.

Additionally, if you are using the Okteto Nginx Ingress Controller, incoming requests will automatically wake a sleeping namespace. However, note that these incoming requests do not count as activity to reset the inactivity counter and keep the namespace awake. The auto-wake behavior for incoming requests can also be disabled by configuring the autowake field.

Manually Wake Sleeping Resources

Okteto's UI will notify you when there are sleeping applications in your namespace. Press the Wake all button to activate all sleeping resources at once.

wake a sleeping resource

Delete Unused Namespaces

Namespaces and all the resources and data contained within will be deleted if they stay sleeping for longer than the delete period.

This only affects Non-Personal Namespaces, Personal Namespaces are not automatically deleted when idle.

Persistent resources
ScaleEnterpriseSelf-Hosted

In case you are interested in the Garbage Collector but you want to skip a specific Namespace, you can mark it as persistent. To do so, you can add the label dev.okteto.com/persistent to it or use the admin view.

In case you want more granularity and only want to persist specific deployments or statefulsets within a Namespace, you can include the label dev.okteto.com/persistent on those resources. In that case, the Garbage Collector will ignore only those specific resources while sleeping the rest of the Namespace.

Configuration Steps
ScaleEnterpriseSelf-Hosted

You can consult the sleep and delete periods in the Admin Dashboard.

You can enable and customize the sleep and delete periods via the garbage collector's settings.