{"id":13928759,"url":"https://github.com/etopeter/kubectl-view-utilization","last_synced_at":"2026-02-10T16:23:58.834Z","repository":{"id":53207719,"uuid":"165444445","full_name":"etopeter/kubectl-view-utilization","owner":"etopeter","description":"kubectl plugin to show cluster CPU and Memory requests utilization","archived":false,"fork":false,"pushed_at":"2020-09-10T01:13:44.000Z","size":236,"stargazers_count":220,"open_issues_count":6,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T01:11:25.889Z","etag":null,"topics":["awk","krew","kubectl","kubectl-plugin","kubernetes"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/etopeter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-12T23:00:02.000Z","updated_at":"2024-08-27T18:38:34.000Z","dependencies_parsed_at":"2022-08-15T19:30:27.073Z","dependency_job_id":null,"html_url":"https://github.com/etopeter/kubectl-view-utilization","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etopeter%2Fkubectl-view-utilization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etopeter%2Fkubectl-view-utilization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etopeter%2Fkubectl-view-utilization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etopeter%2Fkubectl-view-utilization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/etopeter","download_url":"https://codeload.github.com/etopeter/kubectl-view-utilization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226588821,"owners_count":17655794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["awk","krew","kubectl","kubectl-plugin","kubernetes"],"created_at":"2024-08-07T18:01:37.684Z","updated_at":"2026-02-10T16:23:58.807Z","avatar_url":"https://github.com/etopeter.png","language":"Shell","readme":"# `view-utilization` - kubectl plugin to view utilization\n\n---\n[![Build Status](https://travis-ci.org/etopeter/kubectl-view-utilization.svg?branch=master)](\nhttps://travis-ci.org/etopeter/kubectl-view-utilization) [![Test Coverage](\nhttps://api.codeclimate.com/v1/badges/88ad27e772eac5a4e19d/test_coverage)](\nhttps://codeclimate.com/github/etopeter/kubectl-view-utilization/test_coverage) [![license](\nhttps://img.shields.io/github/license/etopeter/kubectl-view-utilization.svg)](\nhttps://github.com/etopeter/kubectl-view-utilization/blob/master/LICENSE\n) [![contributions welcome](\nhttps://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](\nhttps://github.com/etopeter/kubectl-view-utilization/issues)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"static/view-utilization.png\" alt=\"view-utilization\" width=96\u003e\n\u003c/p\u003e\n\n`view-utilization` kubectl plugin that shows cluster resource utilization. It is written in\nBASH/awk and uses kubectl tool to gather information. You can use it to\nestimate cluster capacity and see at a glance overprovisioned resoures\nwith this simple command **`kubectl view-utilization`**.\n\n## Installation\n\n### krew (kubectl plugin manager)\n\n1. [Install krew](https://github.com/GoogleContainerTools/krew)\n   plugin manager for kubectl.\n1. Run `kubectl krew install view-utilization`.\n1. Update plugin with `kubectl krew upgrade view-utilization`\n\n### macOS\n\nOn macOS, plugin can be installed via [Homebrew](https://brew.sh):\n\n```shell\nbrew tap etopeter/tap\nbrew install kubectl-view-utilization\n```\n\n### Install with Curl\n\nFor Kubernetes 1.12 or newer:\n\n```shell\n# Get latest tag\nVIEW_UTILIZATION_PATH=/usr/local/bin\nVIEW_UTILIZATION_TAG=$(curl -s https://api.github.com/repos/etopeter/kubectl-view-utilization/releases/latest | grep  \"tag_name\"| sed -E 's/.*\"([^\"]+)\".*/\\1/')\n\n# Download and unpack plugin\ncurl -sL \"https://github.com/etopeter/kubectl-view-utilization/releases/download/${VIEW_UTILIZATION_TAG}/kubectl-view-utilization-${VIEW_UTILIZATION_TAG}.tar.gz\" |tar xzvf - -C $VIEW_UTILIZATION_PATH\n\n# Rename file if you want to use kubectl view-utilization or leave it if you want to invoke it with kubectl view utilization (with space between). Underscore between words allows kubernetes plugin to have hyphen between words.\nmv $VIEW_UTILIZATION_PATH/kubectl-view-utilization $VIEW_UTILIZATION_PATH/kubectl-view_utilization\n\n# Change permission to allow execution\nchmod +x $VIEW_UTILIZATION_PATH/kubectl-view_utilization\n\n# Check if plugin is detected\nkubectl plugin list\n```\n\n### Dependencies\n\nWhile we try to be as minimalistic as possible the only dependency is [Awk](https://www.gnu.org/software/gawk/). While GNU Awk (gawk) is recommended, `mawk` is also supported.\n\n- kubectl\n- bash\n- awk (gawk, mawk)\n\n## Usage\n\nThis plugin should be invoked with kubectl command, and will appear as\nsubcommand. It will use the existing context configured in `$KUBECONFIG` file.\nYou can override context with `--context` parameter.\n\n```shell\nkubectl view-utilization\nResource     Requests  %Requests        Limits  %Limits   Allocatable   Schedulable         Free\nCPU             43475         81         70731      132         53200          9725            0\nMemory    94371840000         42  147184418816       66  222828834816  128456994816  75644416000\n```\n\n| Column      | Short | Description |\n|-------------|-------|-------------|\n| Requests    | Req   | Calculated total pod requests across all namespaces |\n| %Requests   | %R    | Percentage of total requests against allocatable requests |\n| Limits      | Lim   | Calculated total pod limits across all namespaces  |\n| %Limits     | %L    | Percentage of total limits against allocatable limits |\n| Allocatable | Alloc | Available allocatable resources |\n| Schedulable | Sched | Resources that can be used to schedule pods; Available for pod requests (allocatable - requests) |\n| Free        | Free  | Resources that are outside all requests or limits |\n\nExample usage:\n\nHuman readable format `-h`\n\n```shell\nkubectl view-utilization -h\nResource  Req   %R   Lim    %L  Alloc  Sched  Free\nCPU        43  71%    71  117%     60     17     0\nMemory    88G  37%  138G   58%   237G   149G   99G\n```\n\nCheck utilization for specific namespace `-n`\n\n```shell\nkubectl view-utilization -h -n kube-system\nResource   Req  %R   Lim  %L  Alloc  Sched  Free\nCPU        3.7  6%   4.3  7%     60     57    56\nMemory    5.4G  2%  7.9G  3%   237G   232G  229G\n```\n\nCheck utilization for node groups using label filters.\nExample filter results only for nodes in availability zone us-west-2b `failure-domain.beta.kubernetes.io/zone=us-west-2b`:\n\n```shell\nkubectl view-utilization -l failure-domain.beta.kubernetes.io/zone=us-west-2b -h\nResource  Req   %R  Lim    %L  Alloc  Sched  Free\nCPU        14  64%   24  106%     22      8     0\nMemory    30G  33%  47G   52%    89G    59G   42G\n```\n\nBreakdown of node utilization `kubectl view-utilization nodes`\n\n```shell\nCPU   : ▆▆▆▆▅▅▇▄▄▆▂▆\nMemory: ▇▅▆▇▇▅▅▄▆▇▁▆\n                                           CPU                 Memory               \nNode                                       Req   %R  Lim   %L  Req   %R  Lim   %L\nip-10-0-0-175.us-east-1.compute.internal   8.1  53%   13   86%  24G  83%  31G  105%\nip-10-0-0-55.us-east-1.compute.internal    6.6  43%   13   90%  19G  64%  22G   76%\nip-10-0-18-238.us-east-1.compute.internal    7  46%   12   85%  24G  82%  25G   86%\nip-10-0-19-235.us-east-1.compute.internal   10  67%   14   93%  27G  92%  29G   98%\nip-10-0-21-0.us-east-1.compute.internal    9.5  63%   12   83%  25G  86%  30G  101%\nip-10-0-28-44.us-east-1.compute.internal   6.9  45%   10   70%  20G  70%  24G   81%\nip-10-0-3-133.us-east-1.compute.internal     6  40%   14   97%  20G  67%  24G   83%\nip-10-0-3-24.us-east-1.compute.internal    5.9  39%   10   66%  17G  57%  19G   63%\nip-10-0-35-119.us-east-1.compute.internal  7.7  51%   10   66%  23G  78%  28G   94%\nip-10-0-39-146.us-east-1.compute.internal   10  66%   13   90%  25G  84%  30G  101%\nip-10-0-40-184.us-east-1.compute.internal  3.6  23%  5.7   37%  11G  17%  13G   21%\nip-10-0-42-24.us-east-1.compute.internal   6.6  43%   13   90%  22G  76%  26G   88%\n```\n\nOverview of namespace utilization `kubectl view-utilization namespaces`\n\n```shell\nkubectl view-utilization namespaces -h\n             CPU        Memory\nNamespace     Req  Lim   Req   Lim\nanalitics     6.6   10   14G   21G\nkube-system   3.5  4.2  5.1G  7.6G\nlt             13   21   27G   42G\nmonitoring   0.35  3.5  1.8G  3.5G\nqa             13   21   27G   42G\nrc            6.6   10   14G   21G\n```\n\nOutput to JSON format.\n\n```shell\nkubectl view-utilization -o json | jq\n{\n  \"CPU\": {\n    \"requested\": 43740,\n    \"limits\": 71281,\n    \"allocatable\": 60800,\n    \"schedulable\": 17060,\n    \"free\": 0\n  },\n  \"Memory\": {\n    \"requested\": 94942265344,\n    \"limits\": 148056834048,\n    \"allocatable\": 254661525504,\n    \"schedulable\": 159719260160,\n    \"free\": 106604691456\n  }\n}\n```\n\n---\n\n## Simplify workflow with aliases\n\nAdd to your `~/.bash_profile` or `~/.zshrc`\n\n```shell\nalias kvu=\"kubectl view-utilization -h\"\n```\n\nNow you can use `kvu` alias to quickly show resource usage\n\nExample commands:\n\n```shell\nkvu\nkvu namespaces\nkvu -n kube-system\n```\n\n---\n\n## Change log\n\nSee the [CHANGELOG](CHANGELOG.md) file for details.\n\n## Developing\n\n1. Clone this repo with git\n1. Test locally with kubectl pointing to your cluster (minikube or full cluster)\n1. Run unit tests `make test`\n","funding_links":[],"categories":["kubernetes","Shell","Plugins"],"sub_categories":["[Jenkins](#jenkins)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetopeter%2Fkubectl-view-utilization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetopeter%2Fkubectl-view-utilization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetopeter%2Fkubectl-view-utilization/lists"}