Answers: <p><code>LimitRange</code> for the rescue: by setting both <code>Max</code> limits and <code>LimitRequestRatio</code> for pods users <strong>must</strong> set limits that are lower than Max or request*ratio or apiserver would return <code>403 Forbidden</code>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-07-04T07:16:05.220Z
Answers: 2021-07-04T07:16:05.220Z
Answers: chupasaurus
Body: <p>I'd like to change my pod's CPU request value after a pod has started. Is this possible?</p>
  <p>In our shared kubernetes system there is a requirement that our actual resource usage be &quot;reasonably close&quot; to the resource request value in the yaml, otherwise we limit a users ability to deploy further jobs until they correct their usage requests.</p>
  <p>Therefore it's valuable to me to be able to adjust the resource request value after the job started, if that's possible. Presumably such a request would only succeed if the node has the resources (CPU, Memory) available.</p>
  <p>I noticed there's <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/" rel="nofollow noreferrer">a <code>kubectl patch</code> option</a> to made dynamic updates, but it's not clear that it could accomplish what I'm looking for.</p>
  
Tags: <kubernetes><kubectl>
Title: Change kubernetes resource requests after pod/job has started
UserDisplayName: David Parks
ThreadText: # Change kubernetes resource requests after pod/job has started
  
  (Asked by: username_0 on 2021-07-02)
  
  I'd like to change my pod's CPU request value after a pod has started. Is this possible?
  
  In our shared kubernetes system there is a requirement that our actual resource usage be "reasonably close" to the resource request value in the yaml, otherwise we limit a users ability to deploy further jobs until they correct their usage requests.
  
  Therefore it's valuable to me to be able to adjust the resource request value after the job started, if that's possible. Presumably such a request would only succeed if the node has the resources (CPU, Memory) available.
  
  I noticed there's [a `kubectl patch` option](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/) to made dynamic updates, but it's not clear that it could accomplish what I'm looking for.
  
  **Tags:** kubernetes, kubectl
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-04. Score: 1 | Accepted answer
  
  `LimitRange` for the rescue: by setting both `Max` limits and `LimitRequestRatio` for pods users **must** set limits that are lower than Max or request\*ratio or apiserver would return `403 Forbidden`.
  
  
  ---
  
  