If I want to give request and limit at pod level , rather than container level, so all the container can utilise the common resource of pod, does that work. Is it possible?
CodePudding user response:
I don't think this is possible using Kubernetes as documented here: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-requests-and-limits-of-pod-and-container
Although you can only specify requests and limits for individual containers, it is also useful to think about the overall resource requests and limits for a Pod. For a particular resource, a Pod resource request/limit is the sum of the resource requests/limits of that type for each container in the Pod.
Maybe you can get around this by putting all your processes into the same container?
One possibly working undocumented and highly implementation dependent way you could try is by experimenting with the shareProcessNamespace
property of the PodSpec. I don't know how this is internally implemented by the container runtimes but it could be the case, that in this case the CPU and memory limits are shared by the containers. This is only a wild speculation on my part!