Hands-on Lab·Kubernetes and Cloud Native Security Associate
ResourceQuota and LimitRange as Security Controls
Availability is part of security, and the cheapest denial of service in Kubernetes is a neighbour who asks for everything. A ResourceQuota stops that at admission - and has a side effect people usually meet by accident.
Security Fundamentals Guide 24 of 42 Intermediate
- Kubernetesapiserver v1.36.4, kubelet v1.36.3
- Runtimecontainerd 2.2.6
- CNICilium 1.18.1
- Built withkubeadm v1.36.3
- TimeAbout 14 min
ResourceQuota is a built-in admission controller, enabled by default. The mandatory-requests behaviour is a documented consequence of quoting requests.*, not a bug.
- Host kernel7.0.0-29
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA5001 | 192.168.0.41 | Ubuntu 26.04 LTS | Control Plane Node (tainted NoSchedule) | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE01 | 192.168.0.42 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE02 | 192.168.0.43 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA5001-NODE03 | 192.168.0.44 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when availability is in scope. This matters because the cheapest denial of service in Kubernetes is a workload that consumes everything, and a quota is the built-in admission control that stops it.
- applying a small quota, and finding that a Pod no longer fits the rules
- seeing why quoting
requests.*makes resource requests mandatory for every Pod in the namespace - creating one Pod that fits and then one too many, and reading the refusal
- understanding that the refusal lands at admission, so the Pod is never created rather than left Pending
Before you start
- guide 23 - the boundary a quota applies to.
-
A small quota, and a Pod that no longer fits the rules
-
The limit, enforced