One reason container technology has surpassed virtual machines is that it is possible to put more containers on a host, reducing your overall number of compute instances, and saving you money on your infrastructure costs. If you’re using containers with Kubernetes, though, it is possible to increase efficiency even more by setting sensible CPU and memory requests and limits on pods which will allow you to pack more workloads onto your worker nodes.
How to Enable Resource Recommendations
Until now, the tools to gather data about the efficiency of your Kubernetes workloads have been difficult to install and use, but Fairwinds Insights gives you access to our tool Goldilocks, which helps you get your pod resource requests “just right.” If you’d like to see resource recommendations for your Kubernetes clusters, follow the instructions below:
Once you’ve signed up for the Fairwinds Insights Public Beta Program, login to insights.fairwinds.com, create a new organization, and follow the setup instructions to install Fairwinds Insights in your clusters.
Go back to your organization, and choose which cluster you’d like to see Goldilocks recommendations from.
The dashboard shows a list of namespaces and deployments that are being evaluated by Goldilocks. The tool uses the Kubernetes vertical-pod-autoscaler in recommendation mode, and if you currently have CPU and memory requests and limits set, you will see those values in the “Current” column. The most valuable data is in the “Suggested Changes” box, which show the minimum amounts of CPU and memory you need to set to successfully run your pods. We’ve seen that many of our clients have set their CPU and memory requests and limits too high, and when they apply these recommendations they are able to put more pods on fewer Kubernetes worker nodes. When cluster-autoscaler is enabled, any extra nodes are removed when they are unused, saving you money.
Understand the Balance of Your Workloads
Another benefit of Goldilocks is that it can give you a sense if your workloads are CPU-intensive, memory-intensive or balanced between the two. This data can help you evaluate whether or not you’ve selected the most efficient machine types for your Kubernetes worker nodes.
A few months ago, we generated a Golidlocks report for a customer, and we discovered that one of their deployments generated pods that used almost no CPU, but a lot of memory. We had originally setup their Kubernetes cluster to use just one AWS instance type: m5.xlarge. These machines are designed to strike a balance between compute, memory and network resources, but since their largest deployment of pods were memory-intensive applications, we looked for an AWS EC2 instance type that had more memory resources, but fewer vCPUs. We ended up changing some of their worker nodes to r5.xlarge instances. More of these memory-intensive pods fit on the r5.xlarge worker nodes, and these instance types were 36% cheaper than the original, saving this customer money and reducing the size of their Kubernetes cluster.
If you’re curious about machine types, here are the specs for the three largest cloud-providers:
In summary, Goldilocks — a tool in our Fairwinds Insights suite — helps you and your team set data-informed CPU and memory requests and limits, which can ultimately increase how efficiently you use your cloud infrastructure, reducing the sprawl of your Kubernetes clusters and saving you money.