Slash Your Kubernetes Costs During Development

Using Kubernetes can be quite costly, to be frank. Regardless of the cloud provider you choose for your cluster, there are expenses associated with the deployed applications and the cloud resources they consume. If you're considering adopting Kubernetes-based development and preview environments, you may wonder how to effectively manage these costs. Let's delve deeper into the topic and explore Okteto's Garbage Collector feature, which automates resource management to help reduce cloud infrastructure expenditures.

What Is the Garbage Collector?

Firstly, let's demystify this cool sounding term - Garbage Collector. If you're picturing a physical bin truck rummaging through your Kubernetes cluster, you're not far off the mark. Except, this truck is virtual, and its job is to smartly scale down applications during periods of inactivity. This ensures your cluster isn't bloated with unused resources, keeping your costs manageable.

The beauty of Okteto's Garbage Collector is that it's fully automated, so you don't have to lift a finger. Gone are the days of meticulously tracking which developer's environment is utilizing unnecessary resources while they're on vacation, and constantly reminding them to discard it. The Garbage Collector effortlessly handles these tasks, granting you peace of mind and valuable time to focus on other crucial responsibilities. This powerful feature benefits both Platform Engineers and Developers in multiple ways:

  • Platform Engineers are relieved of the burden of continuously monitoring developers' environments and manually shutting down unused ones.
  • Developers are freed from the cognitive load of remembering to destroy their environments once they've completed their work.

With Okteto's Garbage Collector, efficiency and productivity are maximized, allowing everyone to thrive.

How It Works

The Garbage Collector in Okteto operates through two configurable policies:

  1. The first policy determines the duration of inactivity required to scale all Kubernetes resources in a development or preview environment to zero, effectively putting the namespace to sleep.
  2. The second policy specifies when the environment should be completely destroyed, including all Kubernetes and external resources associated with it.

Configuring the sleep duration before destruction offers the benefit of allowing developers to effortlessly resume their work without the need for redeployment. Okteto simply wakes up their environment by scaling up all their Kubernetes resources to their specified values.

You might be wondering what qualifies as inactivity. According to the Garbage Collector, an application or its resources are considered inactive if a developer hasn't performed any of the following actions during the specified inactivity period:

  • Upgrading or redeploying via the UI or command line.
  • Launching a development container with okteto up.
  • Pushing the latest version of their code using okteto push.

There are a couple of ways to wake up an environment that has been put to sleep. Developers can do this either through the user interface (UI) or via the command line interface (CLI). Another great feature is that if any of the endpoints associated with the development or preview environment receive traffic, Okteto will automatically wake up the environment. This comes in handy when developers share the URL with someone on their team for testing or feedback, and that person or team accesses it after a few days. The garbage collector will ensure that the environment goes to sleep when there is no activity, but as soon as someone accesses that endpoint, it wakes up again.

How Can You Configure It

If you're aiming to optimize your cloud usage and reduce costs, consider configuring the garbage collector for your Okteto installation. You can find detailed steps on how to do this in the accompanying video.

For more information about this feature, please refer to our documentation.

Conclusion

In conclusion, managing infrastructure costs associated with Kubernetes can be quite a challenge. However, with Okteto's Garbage Collector, you can smartly automate resource management, scaling down applications during periods of inactivity, and ensuring your cluster isn't running with unused workloads. This not only saves costs but also improves efficiency, allowing Platform Engineers and Developers to focus on more important tasks. So why wait? Start optimizing your cloud usage and cut back on unnecessary expenses by configuring the Garbage Collector for your Okteto installation today! For detailed steps on how to do this, refer to our accompanying video and documentation.

Arsh SharmaDeveloper Experience Engineer / Emojiologist 😜View all posts

Using ArgoCD With Okteto for a Unified Kubernetes Development Experience

ArgoCD is a powerful tool for continuous deployment that leverages Git repositories as the ultimate source of truth for managing Kubernetes deployments....

July 13, 2023
Avatar of Arsh SharmaAvatar of Arsh SharmaArsh Sharma

Bring Any Cloud Resource to Your Modern App Dev Workflow

How Modern Applications Use Cloud Resources It is very common for the cloud-native microservices we code these days to utilize resources deployed on different...

May 10, 2023
Avatar of Arsh SharmaAvatar of Arsh SharmaArsh Sharma