A new open source tool from Fairwinds called Goldilocks aims to help teams allocate resources to their Kubernetes deployments and get it just right.
It’s a tool that helps teams set the resource requests and limits for their Kubernetes workloads. It’s not easy to know how to set them, and some teams never set them at all, to ill effect, according to the company.
“Every time you create a workload in Kubernetes, you have to specify how much memory and how much CPU that workload is going to use,” explained Robert Brennan, director of open source at the company.
“There’s kind of two halves to getting this right. If you if you set the requests too low, then a normal application is going to look like it’s using too much memory, too much CPU, and Kubernetes will kill it. Which will cause your apps become very unreliable. It could cause downtime, and it could definitely cause your engineers’ pagers to go off in the middle of the night, which is always a pain.
“The other half of it is if you set it too high, which is what people tend to do, then you [allocate] more compute the necessary and your cloud bill is going to be much higher than it needs to be,” he said.
Goldilocks employs the Kubernetes Vertical Pod Autoscaler (VPA), which contains a recommendation engine based on the current amount of resources used in your pods to provide a guideline.
The primary goal of VPA is to actually set those for you, but the company isn’t comfortable with the way it does this and prefers to use it primarily for recommendations, Goldilocks’s creator Andy Suderman writes in a blog post.
“The way we utilize the VPA recommendation engine is simple. We run a controller in the cluster that watches for namespaces that are labeled with goldilocks.fairwinds.com/enabled=true. Within those enabled namespaces, we look at every deployment object and create a corresponding VPA object. That VPA is set with Mode: Off and doesn’t actually modify your resource requests and limits; it just sits there and provides a recommendation,” he wrote.
To view these recommendations, you would have to use kubectl to query every VPA object, which could quickly become tedious if you have medium to large deployments.
The other part of Goldilocks is a dashboard that presents, in one place, two types of recommendations, depending on the quality of service you’re looking for:
- Guaranteed, which means the application will be scheduled on a node where resources will be assured.
- Burstable, which means the application will be guaranteed a minimum level of resources but will be given more if and when available.
- Best effort, which is not recommended, means that no requests or limits are set and the application will only be allocated resources when all other requests are met.
The Goldilocks software is available on GitHub.
The Boston-based managed infrastructure provider previously released an open source tool called Polaris that conducts around 20 checks to ensure that deployments to Kubernetes are configured to best practices.
Image by congerdesign from Pixabay.