Kubernetes resource allocation is notoriously tricky. Under-provisioning leads to outages and performance hits, while over-provisioning wastes costly infrastructure. KRR steps into this gap by analyzing Prometheus metrics from your cluster and suggesting smarter resource requests and limits based on real usage.
What KRR does and how it integrates with Kubernetes
KRR (Kubernetes Resource Recommendations) is an open-source Python CLI tool designed to analyze container and pod metrics collected by Prometheus and generate resource recommendations. It integrates particularly well with kube-prometheus-stack or Robusta’s embedded Prometheus, which provide the necessary metrics out of the box.
Under the hood, KRR queries Prometheus for key metrics like CPU usage (container_cpu_usage_seconds_total), memory working set (container_memory_working_set_bytes), and Kubernetes ownership metadata (kube_replicaset_owner, kube_pod_owner, kube_pod_status_phase). It then processes this data to determine efficient resource requests and limits for your workloads.
The architecture is a CLI-first tool written in Python, which can also run inside a Kubernetes cluster. When run in-cluster, it can leverage additional Robusta Platform features, such as a UI for viewing usage history and applying YAML configurations with recommended resource values. KRR supports multiple installation methods, including Homebrew for Mac/Linux, Docker containers, and manual source installs.
Technical strengths and tradeoffs of KRR
The core strength of KRR lies in its pragmatic use of existing metrics from Prometheus to derive actionable recommendations. It avoids heavy instrumentation or complex machine learning models, instead relying on well-known Kubernetes and container metrics that provide a reliable signal of resource usage.
One notable tradeoff is the dependency on specific Prometheus metrics. If your monitoring setup lacks certain Kubernetes ownership metrics, KRR will still function but only considers currently running pods, missing historical data from terminated pods. This limitation affects the completeness of recommendations but maintains operational usability.
The Python codebase is surprisingly clean and focused, emphasizing querying Prometheus, data aggregation, and YAML generation for Kubernetes manifests. The CLI interface is straightforward, with commands like krr simple to generate recommendations quickly.
Running KRR inside the cluster via the Robusta Platform adds a layer of convenience, providing a UI and easier application of recommendations. However, this also adds dependencies and complexity, which might not be suitable for all environments.
Overall, the code quality and design reflect a tool built for real-world Kubernetes operations, balancing usability with technical constraints inherent in monitoring-based recommendations.
Quick start with KRR
KRR requires Prometheus 2.26+, kube-state-metrics, and cAdvisor to be present in your cluster. If you use kube-prometheus-stack or Robusta’s embedded Prometheus, no additional setup is needed.
To install KRR on Mac or Linux using Homebrew:
brew tap robusta-dev/homebrew-krr
brew install krr
krr --help
krr simple
The first run of krr simple may take a bit longer as it queries Prometheus and processes data.
For Windows users, running KRR on WSL2 with Homebrew or building from source is possible. Alternatively, Docker images and pre-built binaries are available for different platforms and airgapped environments.
Inside Kubernetes, you can also run KRR as part of the Robusta Platform, which offers additional functionalities like a web UI and YAML config application.
Who should consider using KRR
KRR is particularly relevant for Kubernetes operators and DevOps engineers who want to optimize resource allocations without heavy manual tuning. If you already use Prometheus-based monitoring (especially kube-prometheus-stack) and want an automated way to generate recommendations, KRR offers a practical approach.
The tool’s reliance on specific Prometheus metrics means it fits best in clusters with standard monitoring setups. Environments with custom or incomplete Prometheus metrics may see limited benefits.
Running KRR inside your cluster with the Robusta Platform enhances usability but adds operational complexity. For teams comfortable with Kubernetes and Prometheus internals, this is a worthwhile tradeoff.
In summary, KRR fills a common gap in Kubernetes resource management tooling. It’s not a silver bullet but a useful addition to your monitoring and optimization toolkit. The codebase is maintainable, the installation options are flexible, and the approach is grounded in real-world metrics. Worth exploring if you manage Kubernetes at scale and want to reduce guesswork around resource sizing.
Related Articles
- Dokku: A lightweight, Docker-powered mini-Heroku for self-hosting applications — Dokku offers a simple, Docker-based PaaS that lets you deploy apps via Git push on a single server. Ideal for self-hosti
- Lens: A Kubernetes IDE Built for Developer Productivity with a Modern Extension Model — Lens is the leading Kubernetes IDE used by over 1 million developers. It offers a unified UI for cluster management and
- Inside Argo CD: GitOps continuous delivery for Kubernetes with Go — Argo CD implements GitOps for Kubernetes using Go, syncing Git state to clusters with a robust reconciliation loop. Expl
- docker_practice: a comprehensive open-source Docker learning book with containerized local reading — docker_practice offers a systematic Docker learning book with basics, advanced topics, and practical tooling. It uses Do
- Ollama: a unified CLI and API platform for local large language models — Ollama simplifies running and managing open-source large language models locally with a unified CLI and REST API, suppor
→ GitHub Repo: robusta-dev/krr ⭐ 4,577 · Python