{"id":21178447,"url":"https://github.com/elementtech/kube-reqsizer","last_synced_at":"2026-06-16T05:01:21.806Z","repository":{"id":64831080,"uuid":"578573082","full_name":"ElementTech/kube-reqsizer","owner":"ElementTech","description":"A Kubernetes controller for automatically optimizing pod requests based on their continuous usage. VPA alternative that can work with HPA.","archived":false,"fork":false,"pushed_at":"2024-02-09T18:00:52.000Z","size":243,"stargazers_count":203,"open_issues_count":15,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-25T04:46:23.451Z","etag":null,"topics":["autoscaler","autoscaling","controller","k8s","kubernetes","optimization","pod","vpa"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElementTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":"https://www.buymeacoffee.com/jatalocks"}},"created_at":"2022-12-15T11:29:01.000Z","updated_at":"2025-05-20T19:30:43.000Z","dependencies_parsed_at":"2024-06-19T22:54:03.487Z","dependency_job_id":"7737e519-be57-4cd5-b9db-43a1e8d3f19d","html_url":"https://github.com/ElementTech/kube-reqsizer","commit_stats":null,"previous_names":["elementtech/kube-reqsizer","jatalocks/kube-reqsizer"],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/ElementTech/kube-reqsizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fkube-reqsizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fkube-reqsizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fkube-reqsizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fkube-reqsizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElementTech","download_url":"https://codeload.github.com/ElementTech/kube-reqsizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementTech%2Fkube-reqsizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34391703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoscaler","autoscaling","controller","k8s","kubernetes","optimization","pod","vpa"],"created_at":"2024-11-20T17:21:29.937Z","updated_at":"2026-06-16T05:01:21.785Z","avatar_url":"https://github.com/ElementTech.png","language":"Go","funding_links":["https://www.buymeacoffee.com/jatalocks"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/87271817/208631618-0340279e-acf4-4101-bc0b-fac6badc136d.png\" width=\"300\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eA Kubernetes controller to optimize pod requests. A VPA Alternative.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca  target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/jatalocks/kube-reqsizer\" /\u003e\u003c/a\u003e\n\u003ca  target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/downloads/jatalocks/kube-reqsizer/total\"/\u003e\u003c/a\u003e\n\u003ca  target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/jatalocks/kube-reqsizer\"/\u003e\u003c/a\u003e\n\u003ca  target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/go-mod/go-version/jatalocks/kube-reqsizer\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/99724952/208706458-3b0b53ab-e282-497d-92a3-7d835c828097.png\" width=\"800\"\u003e\n\u003c/p\u003e\n\n**kube-reqsizer** is a kubernetes controller that will measure the usage of pods over time and optimize (reduce/increase) their requests based on the average usage.\n\nWhen all required conditions meet, the controller calculates the result requirements based on all the samples taken so far a pod and its peers in the same deployment controller.\nIt then goes \"upstream\" to the parent controller of that pod, for example *Deployment*, and updates the relevant containers for the pods inside the deployment as a reconciliation, as if its desired state is the new state with the new requirements.\n\n\u003cimg src=\"./assets/example.png\" width=\"200\"\u003e\n\n**Note:** This is an alternative to [Vertical-Pod-Autoscaler](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler). The intended use of this project is to provide a simpler, more straightforward install and mechanism, without CRDs, **and that can work with [Horizontal-Pod-Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/).**\n## Deploy - Helm\n\n```bash\nhelm repo add kube-reqsizer https://elementtech.github.io/kube-reqsizer/\nhelm repo update\nhelm install kube-reqsizer/kube-reqsizer\n```\n\n**Core Values:**\n\n```yaml\nenabledAnnotation: true\nsampleSize: 1\nminSeconds: 1\nenableIncrease: true\nenableReduce: true\nmaxMemory: 0\nminMemory: 0\nmaxCPU: 0\nminCPU: 0\nminCPUIncreasePercentage: 0\nminCPUDecreasePercentage: 0\nminMemoryIncreasePercentage: 0\nminMemoryDecreasePercentage: 0\ncpuFactor: 1\nmemoryFactor: 1\nlogLevel: info\nconcurrentWorkers: 10\npersistence:\n  enabled: true\n```\n## Prerequisites\n- The metrics server must be deployed in your cluster. Read more about [Metrics Server](https://github.com/kubernetes-sigs/metrics-server). This controller uses the **metrics.k8s.io** extension API group (apis/metrics.k8s.io/v1beta1)\n\n## Usage\n\n**kube-reqsizer** has primary custom flags:\n\n```bash\n# Enable a annotation filter for pod scraping. \n# True will only set requests of controllers of which PODS or NAMESPACE \n# have the annotation set to \"true\".\n# If \"false\", will ignore annotations and work \n# on all pods in the cluster unless\n# they have \"false\".\n\n# reqsizer.jatalocks.github.io/optimize=true\n# reqsizer.jatalocks.github.io/optimize=false\n--annotation-filter bool (default true)\n\n# The sample size to create an average from when reconciling.\n--sample-size int (default 1)\n\n# Minimum seconds between pod restart.\n# This ensures the controller will not restart a pod if the minimum time\n# has not passed since it has started.\n--min-seconds float (default 1)\n\n# Allow controller to reduce/increase requests\n--enable-increase (default true)\n--enable-reduce (default true)\n\n# Min and Max CPU (m) and Memory (Mi) the controller can set a pod request to. 0 is infinite\n--max-cpu int (default 0)\n--max-memory int (default 0)\n--min-cpu int (default 0)\n--min-memory int (default 0)\n\n# Min CPU and Memory (%) the controller will count as a condition to resize requests.\n# For Example:\n# If reqsizer wants to increase from 90m to 100m, that's a 10% increase. \n# It will ignore it if min-cpu-increase-percentage is more than 10.\n# If reqsizer wants to decrease from 100m to 10m, that's a 90% decrease. \n# It will ignore it if min-cpu-decrease-percentage is more than 90.\n--min-cpu-increase-percentage int (default 0)\n--min-memory-increase-percentage int (default 0)\n--min-cpu-decrease-percentage int (default 0)\n--min-memory-decrease-percentage int (default 0)\n\n# Multiply requests when reconciling\n--cpu-factor float (default 1)\n--memory-factor float (default 1)\n\n# How many pods to sample in parallel. This may affect the controllers stability.\n--concurrent-workers (default 10)\n\n# Persistence using Redis\n--enable-persistence (default false)\n--redis-host (default \"localhost\")\n--redis-port (default \"6379\")\n--redis-password (default \"\")\n--redis-db (default 0)\n```\n\n### Annotations \n\n*If **annotation-filter** is **true**:*\n```\nreqsizer.jatalocks.github.io/optimize=true  # Optimize Pod/Namespace\nreqsizer.jatalocks.github.io/optimize=false # Ignore Pod/Namespace\n```\nThere are Pod/Namespace annotations available *Regardless of **annotation-filter**:*\n```\nreqsizer.jatalocks.github.io/optimize=false # Ignore Pod/Namespace when optimizing entire cluster\nreqsizer.jatalocks.github.io/mode=average   # Default Mode. Optimizes based on average. If ommited, mode is average\nreqsizer.jatalocks.github.io/mode=max       # Sets the request to the MAXIMUM of all sample points\nreqsizer.jatalocks.github.io/mode=min       # Sets the request to the MINIMUM of all sample points\n```\n### Disclaimer\n\n`sample-size` is the amount of data-points the controller will store in cache before constructing an average for the pod. After a requests resizing, the cache will clean itself and a new average will be calculated based on the sample size. If `min-seconds` have not yet passed since the pod has been scheduled, the controller will keep sampling the pod until `min-seconds` have been reached and only then zero the sample and restart from cache.\n\n### Monitoring - Prometheus\n| Metric  | Type | Description |\n| ------------- | ------------- | ------------- |\n| kube_reqsizer_cpu_offset  | Gauge  | Number of milli-cores that have been increased/removed since startup. Can be a positive/negative value.  |\n| kube_reqsizer_memory_offset  | Gauge  | Number of megabits that have been increased/removed since startup. Can be a positive/negative value.  |\n| kube_reqsizer_cache_size  | Gauge  | Number of pod controllers currently in cache.  |\n### Edge Cases\n\n1. All samples in a certain cycle report `0` (less than 1):\n   1. **mode=average**: The controller will ignore the pod and not reconcile.\n   2. **mode=min**: The controller will put `1m` or `1Mi` as a value.\n   3. **mode=max**: The controller will ignore the pod and not reconcile.\n1. One or more of the samples in a certain cycle reports `0` (less than 1):\n   1. **mode=average**: Will take the `0` into consideration.\n   2. **mode=min**: Will consider the `0` as `1`.\n   3. **mode=max**: Will ignore the sample.\n2. **annotation-filter** is `true` (`optimize=false` is as strong as **deny**):\n   1. A namespace has `optimize=false` but a pod has `optimize=true`:\n      1. The controller will ignore the pod and not reconcile.\n   2. A namespace has `optimize=true` but a pod has `optimize=false`:\n      1. The controller will ignore the pod and not reconcile.\n\n## Limitations\n\n- Does not work with CRD controllers (such as Argo Rollouts)\n# Development\n## Getting Started\nYou’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.\n**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).\n\n### Running on the cluster\n\n1. Run the controller:\n```sh\ngo run main.go\n```\n\n**OR**\n\n2. Build and push your image to the location specified by `IMG`:\n\t\n```sh\nmake docker-build docker-push IMG=\u003csome-registry\u003e/kube-reqsizer:tag\n```\n\t\n2. Deploy the controller to the cluster with the image specified by `IMG`:\n\n```sh\nmake deploy IMG=\u003csome-registry\u003e/kube-reqsizer:tag\n```\n### Undeploy controller\nUnDeploy the controller to the cluster:\n\n```sh\nmake undeploy\n```\n\n## Support\n\n\u003ca href=\"https://www.buymeacoffee.com/jatalocks\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/purple_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementtech%2Fkube-reqsizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felementtech%2Fkube-reqsizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felementtech%2Fkube-reqsizer/lists"}