1
votes

Kubernetes: what happens when a pod has no resources limits / requests defined?

How much resources can a pod use in Kubernetes (GKE) when it has no (or only partial) resource limits/requests defined?

For example, I have a pod with only memory limits and memory requests, but it has no cpu specs. Will the cpu available to this pod be:

  • 0
  • as much as left on the node/namespace (total minus all other pod claims)
  • as much as possible regarding actual use by other pods on the node/namespace
1

1 Answers

5
votes

If you do not specify a CPU limit for a Container, then one of these situations applied:

The Container has no upper bound limit on the CPU resources it can use. The Container can use all of the CPU resources available on the Node where the pod is running. So in your case it will be second option which you have specified in your question : as much as left on the node/namespace.

Normally Kubernetes Cluster Administrator defines the limit for each and every namespace in cluster. so the Container is running in a namespace that has a default CPU limit, and the Container is automatically assigned the default limit.

Resource Quota should be defined for each Namespace which comes in handy to get rid of pods that don't have resource request or limits and eating up all the resources. This means you can not schedule the pod until you specify the resource requirements for that pod in particular namespace and this is recommended as best practices

For more information you could refer to this section : https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#if-you-do-not-specify-a-cpu-limit