7 Best Tools for Setting Container Resource Limits
Seven tools for setting and checking container resource limits on CPU and memory, from Docker and Kubernetes to Goldilocks, K9s and cAdvisor and alerts.
On this page
Key takeaways
- Docker and Kubernetes set CPU and memory limits directly on containers and pods.
- cAdvisor reports actual container usage so limits can be compared with real demand.
- Goldilocks recommends request and limit values based on live Kubernetes usage.
- kube-state-metrics exposes object data, and K9s inspects pods from a terminal UI.
- containerd applies the limits at the runtime layer where the container runs.
Why container resource limits matter
A container without limits can take all the CPU and memory on a node and crowd out every other workload. Setting a limit keeps one busy service from harming its neighbors, and it gives a cluster predictable behavior. The goal is to pick values that are tight enough to protect the node but loose enough for the application to run well.
The tools below cover each step of that job. Some set the limits, some measure real usage, and some recommend better numbers. Teams often combine a runtime with a metrics tool and a recommendation tool to keep limits close to what each workload actually needs.
Quick comparison
| Tool | Best for | Starting price | Free plan |
|---|---|---|---|
| Docker | Container platform | Not included | Not included |
| Kubernetes | Container orchestration | Not included | Not included |
| cAdvisor | Container resource metrics | Not included | Not included |
| Goldilocks | Rightsize Kubernetes requests | Not included | Not included |
| kube-state-metrics | Kubernetes object metrics | Not included | Not included |
| K9s | Terminal UI for Kubernetes | Not included | Not included |
| containerd | Container runtime | Not included | Not included |
The best tools for setting container resource limits
1. Docker
- Official site: https://www.docker.com/
- Best for: Container platform
- Starting price: Not included
- Free plan: Not included
- Pros: Simple flags; wide support
- Cons: Single host focus; manual sizing
Docker is the container platform that most teams use to build and run container images. Its run and compose commands accept CPU and memory limits as flags or fields, so a single container can be capped without any orchestration. That makes it the first place a developer learns how limits work on a local machine.
Docker manages one host at a time, and choosing the right limit is still a manual decision. For multi node systems, the same limit settings move into Kubernetes. Docker remains useful for local work and for servers that run containers without a full orchestrator.
2. Kubernetes
- Official site: https://kubernetes.io/
- Best for: Container orchestration
- Starting price: Not included
- Free plan: Not included
- Pros: Requests and limits; scheduler aware
- Cons: Complex; steep learning
Kubernetes is the orchestration system that schedules containers across many nodes. Each pod can declare a request and a limit for CPU and memory, and the scheduler uses those values to place workloads where room exists. The limit caps consumption, while the request reserves a baseline amount for the pod.
Running Kubernetes adds real operational complexity, but it turns limits into a first class part of the platform. Because limits drive scheduling and protection together, Kubernetes is where most production limit policies live. Teams define them in pod specs and manage them through deployments and namespaces.
3. cAdvisor
- Official site: https://github.com/google/cadvisor
- Best for: Container resource metrics
- Starting price: Not included
- Free plan: Not included
- Pros: Usage data; simple
- Cons: No enforcement; short retention
cAdvisor is a monitoring agent that reports CPU and memory usage for running containers, and it is often built into Kubernetes nodes. It shows what a container actually uses, which is the number a team needs before it can pick a sensible limit. Without that data, limits become guesses that are either too tight or far too generous.
cAdvisor measures but does not enforce anything, and it keeps only a short history on its own. Its role is to feed usage numbers into Prometheus and dashboards. From there, a team can compare real demand against the limits it has set and adjust them with evidence.
4. Goldilocks
- Official site: https://github.com/FairwindsOps/goldilocks
- Best for: Rightsize Kubernetes requests
- Starting price: Not included
- Free plan: Not included
- Pros: Automatic recommendations; clear output
- Cons: Needs metrics; Kubernetes only
Goldilocks is an open source tool that watches Kubernetes workloads and recommends request and limit values for each one. It reads usage data from the cluster metrics pipeline and renders a dashboard that suggests numbers close to observed demand. Teams use it to move from hand picked values toward data backed sizing.
The tool depends on metrics being present in the cluster, and it works only within Kubernetes. Its value comes from turning real usage into a starting point for limits. That saves the manual work of reading charts and guessing a value for every deployment.
5. kube-state-metrics
- Official site: https://github.com/kubernetes/kube-state-metrics
- Best for: Kubernetes object metrics
- Starting price: Not included
- Free plan: Not included
- Pros: Object visibility; Prometheus ready
- Cons: No usage data; indirect
kube-state-metrics is an exporter that turns the state of Kubernetes objects into Prometheus metrics. It reports the declared requests and limits on each pod, deployment and namespace, along with status fields. That gives a team a queryable view of what limits are actually configured across the cluster.
It reports configuration, not measured usage, so it complements rather than replaces a usage collector like cAdvisor. Together the two tell a team what a workload is allowed to use and what it really consumes. That pairing is the standard way to audit limits at scale.
6. K9s
- Official site: https://k9scli.io/
- Best for: Terminal UI for Kubernetes
- Starting price: Not included
- Free plan: Not included
- Pros: Fast inspection; keyboard driven
- Cons: Read only view; terminal only
K9s is a terminal UI for Kubernetes that lets an operator browse pods, deployments and other resources quickly from the keyboard. It shows resource requests and limits in the pod view, so a team can check the settings on any workload without writing long kubectl commands. The interface stays fast even on a busy cluster.
K9s is a viewer rather than a policy tool, so it does not set or recommend limits. Its strength is speed of inspection during an incident or a review. Operators use it to spot pods with missing limits or unusual values in seconds.
7. containerd
- Official site: https://containerd.io/
- Best for: Container runtime
- Starting price: Not included
- Free plan: Not included
- Pros: Industry standard; low overhead
- Cons: Low level; not user facing
containerd is the container runtime that manages images and running containers on a node, and it is the default runtime under many Kubernetes clusters. It applies the CPU and memory limits that higher layers define, using Linux control groups to cap each container's use. That enforcement is what actually keeps a container within its bounds.
Because it sits at a low level, containerd is not a tool people configure limits in directly. Its job is to carry out the limits set by Docker, Kubernetes or another layer. Knowing it exists helps a team understand where enforcement really happens in the stack.
How we chose
The list follows a limit from declaration to enforcement and back to review. Some tools write the value, some measure usage, and some make the value visible, and a complete workflow touches all of them.
Preference went to tools that are standard in container environments and that help a team pick limits based on data rather than guesswork. Each one plays a clear role in keeping one workload from starving its neighbors.
FAQ
What is the difference between a request and a limit?
A request reserves a minimum amount of CPU or memory for a pod, while a limit caps its maximum use. Kubernetes uses requests for scheduling and limits for enforcement.
Why do containers need limits?
Limits stop one container from consuming all of a node's CPU and memory and hurting other workloads. They make resource use predictable across a shared cluster.
How does Goldilocks choose its values?
Goldilocks reads observed usage from cluster metrics and recommends request and limit values close to that demand. The suggestions are a starting point that teams still review.
Which tool shows actual container usage?
cAdvisor reports real CPU and memory use for running containers and feeds that data into Prometheus. It is the standard source for comparing usage against limits.
Where are limits actually enforced?
The container runtime, usually containerd under Kubernetes, enforces limits through Linux control groups. Higher layers such as Kubernetes and Docker declare the values that the runtime applies.