{{text-cta}}
You should set resource limits!
Managing resources for containers in a Kubernetes cluster is very important.
The thing is, it can be a very tedious job, as every service might have different requirements.
A service might be a generic micro-service that serves data from a database and requires 4GB of ram. While another service could be doing complex AI computations and requires 40GB of RAM.
Setting a system wide memory/CPU limit just doesn’t make the cut.
{{nana-cta}}
Here is how you can set limits
Each container of a pod can specify one or more of the following limits:
Example of usage:
Scanning and Enforcing
Here's how you can search your existing files and verify if they have resource limits and requests configured.
Configuring those steps as mandatory checking during the CI/CD process is highly recommended.
Here are two ways in which you can check if the Kubernetes manifests have the limits sets.
Scripting
Scan files to find if they have resource limits and requests using yq.
{{text-cta}}
Using Datree
You can use Datree scan Kubernetes manifest files in order to see if they have limits and resources set (and much more).
Bonus: Helm
But what if I manage my Kubernetes resources using Helm?
Here's how you can render your Helm charts into YAML manifests and apply the tests:
Learn from Nana, AWS Hero & CNCF Ambassador, how to enforce K8s best practices with Datree
Headingajsdajk jkahskjafhkasj khfsakjhf
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.