Home > Software design >  GKE Autopilot changes the limits/requests resources of a pod in a wrong way
GKE Autopilot changes the limits/requests resources of a pod in a wrong way

Time:12-08

When I launch a pod with the following limits/request:

    resources:
  limits:
    cpu: "3500m"
    memory: "8192Mi"
    ephemeral-storage: "5Gi"
  requests:
    cpu: "500m"
    memory: "512Mi"
    ephemeral-storage: "2Gi"

Autopilot modifies the resources limits and set them equals to the request ones:

autopilot.gke.io/resource-adjustment: {"input":{"containers":[{"limits":{"cpu":"3500m","ephemeral-storage":"5Gi","memory":"8Gi"},"requests":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"512Mi"},"name":"prueba-init-container"}]},"output":{"containers":[{"limits":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"512Mi"},"requests":{"cpu":"500m","ephemeral-storage":"2Gi","memory":"512Mi"},"name":"prueba-init-container"}]},"modified":true} seccomp.security.alpha.kubernetes.io/pod: runtime/default

CodePudding user response:

Resource limits need to be equal to requested resources for GKE autopilot

That is the default behavior of the GKE autopilot. Read More

Perhaps, this restriction is to make it easier for Google to bill you better, with GKE Autopilot, you lose the ability to set a resource limit higher than the requested CPU and memory resources.

You need to ensure that you give from the start enough resources to your pod, no less, no more.

This is not a mistake. If you try to set a higher limit, GKE Autopilot will just override your limit and make it equal to the requested value.

Resource limits

In an Autopilot cluster, each Pod is treated as a Guaranteed QoS Class Pod, with limits that are equal to requests. Autopilot automatically sets resource limits equal to requests if you do not have resource limits specified. If you do specify resource limits, your limits will be overridden and set to be equal to the requests.

  • Related