Search⌘ K

Defining Resource Quotas for a Namespace

Explore how to implement ResourceQuota objects in Kubernetes to limit aggregate resource consumption within namespaces. Understand setting CPU and memory quotas, limiting pod counts, and restricting node port usage to prevent resource exhaustion and maintain cluster stability.

The problem

Resource defaults and limitations are a good first step towards preventing malicious or accidental deployment of Pods that can potentially produce adverse effects on the cluster. Still, any user with the permissions to create Pods in a namespace can overload the system. Even if max values are set to some reasonably small amount of memory and CPU, a user could deploy thousands or even millions of Pods and consume all the available cluster resources. Such an effect might not be even produced out of malice but accidentally.

A Pod might be attached to a system that scales it automatically without defining upper bounds, ...