Black Friday · 27 Nov 2026

Up to 90% off selected certifications.

One time only offer for a very precious career goal. Limited coupons, waitlist first.

Free lesson · CKAD Prep Program · Module 5: Environment, configuration and security

Enforce Quotas and Pod Security Standards

Namespaces need budgets and bouncers: quotas bound consumption, Pod Security Standards reject dangerous pods at admission. Both fail closed with messages that name the rule.

12 min reading

Objectives

  • Cap a namespace with ResourceQuota so one team cannot starve others
  • Bound object counts and requests-plus-limits totals separately
  • Apply baseline versus restricted Pod Security Standards per namespace
  • Read an admission rejection back to the exact violated rule

Why this matters

Multi-tenant clusters die by tragedy of the commons: one namespace's runaway consumes the cluster, one privileged pod weakens every neighbor. Quotas plus standards move these from tribal knowledge to enforced admission, and the exam tests reading the rejections because every violation prints its reason.

Concepts

ResourceQuota caps a namespace: compute totals (requests plus limits for CPU and memory), object counts (pods, services, PVCs), and class-scoped flavors. Quota counts only objects that declare the tracked fields, which is why quota plus LimitRange pair well: the range supplies defaults so every pod counts. Exceeding quota rejects creation with the exceeded figure quoted.

Pod Security Standards define three profiles: privileged (unrestricted, for system agents only), baseline (blocks known privilege escalations while allowing normal apps), restricted (demands non-root, dropped caps, seccomp: the hardened default for your apps). Enforcement is per-namespace via labels (pod-security.kubernetes.io/enforce: restricted), with warn plus audit modes for migration before enforcement bites.

Worked example

Team namespace with a budget plus a bouncer, violations demonstrated:

# budget: 8 CPU requests, 16Gi memory, 10 pods max
apiVersion: v1
kind: ResourceQuota
metadata: { name: team-budget, namespace: team-a }
spec:
  hard: { requests.cpu: "8", requests.memory: 16Gi, pods: "10" }
# bouncer: restricted enforced, baseline warned during migration
kubectl label namespace team-a \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/warn=baseline
# violation one: 11th pod rejected naming the quota
# violation two: privileged pod rejected naming the policy
kubectl apply -f privileged-pod.yaml  # Forbidden: violates PodSecurity "restricted:latest"

Both rejections quote the rule: the quota names the exceeded hard figure, the policy names the violated check. Read the message, fix the manifest, never the enforcement.

Exam notes

Quota ignores objects missing the tracked fields: unrequested pods dodge compute quota, which is why LimitRange closes the loop. Standards evaluate the whole pod: one privileged container fails the namespace. And enforce versus warn versus audit stack deliberately: migrate namespaces through warn before enforce or the first deploy becomes the incident.

Quick check

A 4-question self-check. Your answers stay on your device, are never stored or sent. Only a passing score (for example 3 of 4) is saved, and only to unlock lesson progress: at least 3 correct is required before a lesson counts as complete. It never counts toward any certification assessment.

Lesson feedback

No published feedback yet.

Log in and complete the lesson to leave feedback.

Exercise

Give a fictional team namespace a quota (CPU, memory, pod count) plus restricted enforcement, then trigger one rejection of each kind and quote what each message names. State the LimitRange pairing that closes the quota gap.

Pass criteria

Quota plus labels valid; both rejections reproduced with the quoted rule names; LimitRange answer names default requests that make every pod countable.

Sources

Log in to track progressFree account: stores only your lesson progress and quiz results.