3

Does anyone know how to override what seems to be the default LimitRange in GKE which sets the default request for CPU to 100m?

I've previously updated the limit to be 10m which is still overkill but better than the default using the following manifest;

apiVersion: v1
kind: LimitRange
metadata:
  name: limits
  namespace: default
spec:
  limits:
  - defaultRequest:
      cpu: 10m
    type: Container

This has since been overwritten back to 100m. Can I disable this behaviour?

Clearly I could update my manifest file to always include the request amount on containers but I'm interested to understand how this works in GKE and if it's documented.

Tim Reynolds
  • 421
  • 2
  • 14
  • This might help. https://stackoverflow.com/questions/33391748/how-to-reduce-cpu-limits-of-kubernetes-system-resources?rq=1 – Ananthu R V Nov 12 '18 at 10:39
  • Possible duplicate of [How to reduce CPU limits of kubernetes system resources?](https://stackoverflow.com/questions/33391748/how-to-reduce-cpu-limits-of-kubernetes-system-resources) – Ananthu R V Nov 12 '18 at 10:39
  • @AnanthuRV So I've tried setting the limit to a lower value however it was overwritten as stated in my question. – Tim Reynolds Nov 12 '18 at 14:04
  • Can you try giving `10` instead of `10m`. Kubernetes example seems to be like that https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/admin/resource/cpu-defaults.yaml – Ananthu R V Nov 13 '18 at 07:32
  • 1
    I saw similar behaviour where my default limits that I've changed had been overridden :/ – Bartosz Hernas Dec 20 '18 at 10:07
  • You can see this bug in action in your Stackdriver logs -- there, you'll see a patch made by `system:addon-manager`. Search for `protoPayload.response."@type"="core.k8s.io/v1.LimitRange"`. I'm not sure how long it takes for the bug to manifest as I've only ever noticed it days after I've changed the LimitRange resource (per the logs, the values I set had survived for about 25 days). –  Dec 11 '20 at 00:10

1 Answers1

1

From reading the attached github article, there is a Limit Range set within the default namespace. If you would like to change the Limit Range, you can create a Limit Range in a non-default namespace. You can read on how to create a Limit Range in a non default namespace here.

Jason
  • 628
  • 3
  • 10
  • Yea, I think the only way around this is to not use the default namespace. We've just set the limit on all containers now – Tim Reynolds Dec 20 '18 at 14:23
  • @TimReynolds when he set ```namespace: default```. Will, it applied to one cluster only right? How to know which cluster LimtiRange is applied if there are more clusters? – Anant Apr 02 '20 at 18:35
  • my question is how to know to which cluster sLimitRange was applied? – Anant Apr 02 '20 at 18:37