postgres-operator
postgres-operator copied to clipboard
Allow setting null resource requests / limits
We've removed the
requiredflag forresourcesin the CRD schema starting fromv1.8.0.
Originally posted by @FxKu in https://github.com/zalando/postgres-operator/issues/2028#issuecomment-1234071399
This isn't enough to not have any CPU/memory limits for containers. If the value isn't set in the CRD then the configured default or minimum value takes effect. If those are set to 0 then Kubernetes can't create pods because the limit would be lower than the requests.
We need some way of not setting a CPU limit at all in order to avoid unnecessary throttling. Please see https://home.robusta.dev/blog/stop-using-cpu-limits/ for a discussion about this.
In our K8s setup CPU limits are ignored π The operator should indeed allow to not define any resources when defaults are 0. Or we just remove the CPU limit default.
Yeah, this is a big problem. CPU limits cause throttling, and we can't unset them.
Is there any update? Also had issues with this setting the last days.
https://opensource.zalando.com/postgres-operator/docs/reference/operator_parameters.html#kubernetes-resource-requests
default_cpu_limit CPU limits for the Postgres containers, unless overridden by cluster-specific settings. The default is 1.
So, if I set the cpu request > 1 and no set cpu limit, I get an error
Warning FailedCreate 78s (x15 over 2m40s) statefulset-controller create Pod pg-test-0 in StatefulSet pg-test failed error: Pod "pg-test-0" is invalid: spec.containers[0].resources.requests: Invalid value: "8": must be less than or equal to cpu limit
Limits:
cpu: 1
memory: 16Gi
Requests:
cpu: 8
memory: 16Gi
@yolkov Yes, this is another manifestation of the same problem. The problem is that if you don't set CPU limits in your postgresql object, the operator will default the CPU limit to "1", which is less than your "8" requested, which is not allowed because it doesn't make sense.
I just found another related issue. If we don't set cpu limits at all (in our case we don't use CPU limits at least for most apps, we only use memory limits) by default it's set to:
limits:
cpu: "1"
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
We solved that by setting cpu limits to 1 but if it's not set then it should not be used at all now we have this:
limits:
cpu: "1"
memory: 500Mi
requests:
cpu: "1"
memory: 100Mi
version: v1.11.0
So the issue is not resolved. I have version 1.11.0. And either I try to set β0β, or donβt set the limit, it still makes me β1β