{"id":26648947,"url":"https://github.com/larssonoliver/kubectl-set_pod_resources","last_synced_at":"2026-02-19T13:02:58.323Z","repository":{"id":283624936,"uuid":"951795844","full_name":"LarssonOliver/kubectl-set_pod_resources","owner":"LarssonOliver","description":"Kubectl plugin designed to simplify InPlacePodVerticalScaling.","archived":false,"fork":false,"pushed_at":"2025-04-16T23:22:12.000Z","size":31631,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T02:15:17.947Z","etag":null,"topics":["go","golang","kubectl","kubectl-command","kubectl-plugin","kubernetes","plugin"],"latest_commit_sha":null,"homepage":"","language":"Go","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/LarssonOliver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-03-20T08:59:36.000Z","updated_at":"2025-03-31T14:07:22.000Z","dependencies_parsed_at":"2025-03-21T08:41:43.552Z","dependency_job_id":null,"html_url":"https://github.com/LarssonOliver/kubectl-set_pod_resources","commit_stats":null,"previous_names":["larssonoliver/kubectl-set_pod_resources"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LarssonOliver/kubectl-set_pod_resources","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarssonOliver%2Fkubectl-set_pod_resources","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarssonOliver%2Fkubectl-set_pod_resources/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarssonOliver%2Fkubectl-set_pod_resources/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarssonOliver%2Fkubectl-set_pod_resources/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LarssonOliver","download_url":"https://codeload.github.com/LarssonOliver/kubectl-set_pod_resources/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarssonOliver%2Fkubectl-set_pod_resources/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265571125,"owners_count":23790020,"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":["go","golang","kubectl","kubectl-command","kubectl-plugin","kubernetes","plugin"],"created_at":"2025-03-25T00:47:25.500Z","updated_at":"2026-02-19T13:02:58.317Z","avatar_url":"https://github.com/LarssonOliver.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubectl-set_pod_resources\n\n\u003cdiv align=\"center\"\u003e\n\n  ![GitHub License](https://img.shields.io/github/license/larssonoliver/kubectl-set_pod_resources)\n  ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/larssonoliver/kubectl-set_pod_resources)\n\n\u003c/div\u003e\n\n## Overview\nkubectl-set_pod_resources is a plugin designed to simplify \nInPlacePodVerticalScaling using the `kubectl` CLI tool.\n\n### Background\nSince Kubernetes 1.32, resizing of already running pods must be done using the\npod `/resize` API sub resource. This means the `kubectl set resources` command\nor `kubectl patch` (including `kubectl edit`) no longer works to edit resources\nof pods directly as it did pre-1.32. See this PR for additional \ninfo: kubernetes/kubernetes#128266. \n\nSure, but **what does this mean?**\n\nWell, resizing the CPU of a running pod could previously be done using the\nfollowing command:\n```bash\nkubectl set resources pod nginx --requests=cpu=2 --limits=cpu=4\n```\nNot too bad! 👍\n\nSince 1.32 however, the same command will be rejected by the API server.\nInstead, we have to type out this monstrosity:\n```bash\nkubectl patch pod nginx --subresource resize --patch '{\"spec\":{\"containers\":[{\"name\":\"nginx\",\"resources\":{\"requests\":{\"cpu\":\"2\"},\"limits\":{\"cpu\":\"4\"}}}]}}'\n```\nFor scripting I guess this is fine, but I regularly type this when experimenting. 🤮\n\n### The Solution\nThis plugin enables the use of the `set resources` syntax, but invokes the\n`/resize` subresource in the background and thus works for pods. The above\nresource patch becomes:\n```bash\nkubectl set-pod-resources nginx --requests=cpu=2 --limits=cpu=4\n```\nNot too bad if I say so myself! 😎\n\n\n## Building \nThis project requires `go 1.24.0`.\n```bash\nmake\n```\n\nThis produces the binary `bin/kubectl-set_pod_resources`.\n\n## Installation\nSimply place the `kubectl-set_pod_resources` binary somewhere in your `PATH`.\nFor shell completion, also include the `bin/kubectl_complete-set_pod_resources`\nsomewhere in your `PATH`.\n\nExample:\n```bash\nsudo cp bin/* /usr/local/bin\n```\n\nOr, to make development easier:\n```bash\nsudo ln -s $(pwd)/bin/* /usr/local/bin/\n```\n\n### Uninstall\nRemove the previously installed files from `PATH`. That is: \n- `kubectl-set_pod_resources`\n- `kubectl_complete-set_pod_resources`\n\n## Usage\nAfter installation, you can use the plugin with the following commands:\n\n```bash\n$ kubectl set-pod-resources --help\n```\n```\nResize the resources of a pod\n\nUsage:\n  kubectl set-pod-resources [pod-name] [container] [flags]\n\nExamples:\n\n  # Set the requested resources of a pod named 'foo' to 1Gi of memory and 200m of CPU\n  kubectl set-pod-resources foo --requests=memory=1Gi,cpu=200m\n\n  # Set the limits of a pod named 'foo' to 2Gi of memory and 500m of CPU\n  kubectl set-pod-resources foo --limits=memory=2Gi,cpu=500m\n\n  # Set the requests of a container named 'bar' in a pod named 'foo' to 1Gi of memory and 200m of CPU\n  kubectl set-pod-resources foo bar --requests=memory=1Gi,cpu=200m\n\nFlags:\n      --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.\n      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.\n      --as-uid string                  UID to impersonate for the operation.\n      --cache-dir string               Default cache directory (default \"/home/olars/.kube/cache\")\n      --certificate-authority string   Path to a cert file for the certificate authority\n      --client-certificate string      Path to a client certificate file for TLS\n      --client-key string              Path to a client key file for TLS\n      --cluster string                 The name of the kubeconfig cluster to use\n  -c, --containers string              The names of containers in the selected pod templates to change, all containers are selected by default - may use wildcards (default \"*\")\n      --context string                 The name of the kubeconfig context to use\n      --disable-compression            If true, opt-out of response compression for all requests to the server\n  -h, --help                           help for kubectl set-pod-resources\n      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure\n      --kubeconfig string              Path to the kubeconfig file to use for CLI requests.\n      --limits string                  The resource requirement requests for this container.  For example, 'cpu=100m,memory=256Mi'.\n  -n, --namespace string               If present, the namespace scope for this CLI request\n      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default \"0\")\n      --requests string                The resource requirement requests for this container.  For example, 'cpu=100m,memory=256Mi'.\n  -l, --selector string                Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.\n  -s, --server string                  The address and port of the Kubernetes API server\n      --tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used\n      --token string                   Bearer token for authentication to the API server\n      --user string                    The name of the kubeconfig user to use\n  -v, --version                        version for kubectl set-pod-resources\n```\n\n## Disclosure\nThis project is heavily based off of the Kubernetes \n[sample-cli-plugin](https://github.com/kubernetes/sample-cli-plugin) repository \nand the source for the `kubectl set resources` command \n([set_resources.go](https://github.com/kubernetes/kubectl/blob/7577f36fbc78c41770457b39947be836ab8df949/pkg/cmd/set/set_resources.go)).\n\n## License\nThis project is licensed under the Apache 2.0 license - see the LICENSE file for details.\n\nAny source taken from the [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)\nrepository is similarly licensed under the Apache 2.0 license - Copyright The Kubernetes Authors.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarssonoliver%2Fkubectl-set_pod_resources","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarssonoliver%2Fkubectl-set_pod_resources","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarssonoliver%2Fkubectl-set_pod_resources/lists"}