Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure resource limits in a pod via cli

Tags:

kubernetes

I am trying to run a pod where the default limit of my GKE AutoPilot Cluster is 500m vCPU.. But I want to run all my pods by 250m vCPU only. I tried the command kubectl run pod-0 --requests="cpu=150m" --restart=Never --image=example/only

But I get a warning: Flag --requests has been deprecated, has no effect and will be removed in the future. Then when I describe my pod, it sets 500m. I would like to know option to set resource limits with just plainly kubectl run pod

like image 608
Dean Christian Armada Avatar asked Oct 24 '25 14:10

Dean Christian Armada


1 Answers

Since kubectl v1.21 All generators are deprecated.

Github issue: Remove generators from kubectl commands quote:

kubectl command are going to get rid of the dependency on the generators, and ultimately remove them entirely. The main goal is to simplify the use of kubectl command. This is already done in kubectl run, see #87077 and #68132.

So it looks like --limits and --requests flags willn't longer be available in the future.

Here is the PR that did it: Drop deprecated run flags and deprecate unused ones.

like image 180
Matt Avatar answered Oct 26 '25 18:10

Matt