Skip to content

KCSA · Domain 5: Platform Security · 16% of the exam

Task 5.7: Admission Control

Admission controller phases, mutating and validating webhooks, failure policies, ValidatingAdmissionPolicy and policy engines.

Study it

  • Admission control

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.

Question 1 · choose 1

Compliance sets two rules for namespace payments: nobody outside the payments team may read its Secrets, and changes to existing Secrets there must be rejected outside the weekly release window. An engineer already runs a validating admission webhook that knows the release calendar and proposes extending it to cover both rules. Which design meets both rules?

  1. AExtend the webhook to both rules, matching get, list and update requests on Secrets
  2. BEncrypt the Secrets at rest with a KMS v2 key only the payments team holds, and keep the webhook for changes
  3. CAdd a ValidatingAdmissionPolicy for the read rule, and keep the webhook for changes
  4. DUse RBAC so that only the payments team can read the Secrets, and keep the webhook for the change rule
Show the answer and why
  • AExtend the webhook to both rules, matching get, list and update requests on Secrets

    Incorrect

    Admission controllers do not and cannot block get, watch or list requests, because reads bypass the admission layer; the read rule would never be checked.

  • BEncrypt the Secrets at rest with a KMS v2 key only the payments team holds, and keep the webhook for changes

    Incorrect

    Encryption at rest protects the data stored in etcd; the API server decrypts it for any request that authorization allows, so other users can still read the Secrets through the API.

  • CAdd a ValidatingAdmissionPolicy for the read rule, and keep the webhook for changes

    Incorrect

    A ValidatingAdmissionPolicy is also part of admission control, so it is not consulted for reads either.

  • DUse RBAC so that only the payments team can read the Secrets, and keep the webhook for the change rule

    Correct

    Who may read is decided by authorization, which RBAC rules grant only to the payments team; updates do pass through admission, where the webhook can reject them outside the window.

Admission control sees requests that create, modify or delete objects, but reads skip it entirely. Restricting reads is an authorization task, so RBAC grants read access on Secrets only to the payments team, while a time-based rule on updates fits a validating webhook, which receives those requests.

Question 2 · choose 1

Two mutating admission webhooks in a cluster change Pods: one injects a logging sidecar, and the other sets resource defaults on every container. The second webhook's authors assume it always runs after the first, so that the sidecar also gets defaults. What does the Kubernetes guidance on admission webhooks advise?

  1. ADon't rely on the order; use a reinvocation policy and idempotent webhooks
  2. BName the webhooks so that they sort alphabetically in the intended order
  3. CGive both webhooks the same name so that the API server merges them
  4. DRaise timeoutSeconds so that the first webhook finishes before the second starts
Show the answer and why
  • ADon't rely on the order; use a reinvocation policy and idempotent webhooks

    Correct

    The good practices say mutating webhooks don't run in a consistent order, suggest a reinvocation policy to re-run after other changes, and ask for every mutating webhook to be idempotent.

  • BName the webhooks so that they sort alphabetically in the intended order

    Incorrect

    The guidance says not to rely on a webhook running at a specific point; naming is not a supported way to fix the order.

  • CGive both webhooks the same name so that the API server merges them

    Incorrect

    Each webhook is a separate entry; the guidance is to use reinvocation and idempotent webhooks rather than depend on how they are combined or ordered.

  • DRaise timeoutSeconds so that the first webhook finishes before the second starts

    Incorrect

    Webhooks are called in sequence anyway; the guidance recommends small timeouts, and timeouts do not decide order.

Mutating admission webhooks may be called in any order and some may be called more than once. The webhook good practices advise against depending on order: use a reinvocation policy to observe changes made by other plugins, validate mutations before admission, and make each webhook idempotent.

Question 3 · choose 1

What is the difference between mutating and validating admission controllers?

  1. AMutating controllers handle only Pods; validating controllers handle all other resources
  2. BMutating controllers may change the admitted object; validating ones may not
  3. CValidating controllers can change objects; mutating controllers only log them
  4. DMutating controllers run in the kubelet; validating controllers run in the API server
Show the answer and why
  • AMutating controllers handle only Pods; validating controllers handle all other resources

    Incorrect

    Both kinds can apply to whatever resources they are configured for; the difference is whether they may change the object.

  • BMutating controllers may change the admitted object; validating ones may not

    Correct

    The admission controller reference says mutating controllers may modify the data for the resource being modified, while validating controllers may not.

  • CValidating controllers can change objects; mutating controllers only log them

    Incorrect

    It is the other way round: mutating controllers may change objects.

  • DMutating controllers run in the kubelet; validating controllers run in the API server

    Incorrect

    Both kinds run as part of the API server's admission chain.

Admission controllers intercept write requests after authentication and authorization. Mutating ones may change the incoming object, for example to set defaults; validating ones only accept or reject it.

Question 4 · choose 1

What do the Kubernetes admission webhook good practices recommend about objects in the kube-system namespace?

  1. AMatch all of them, since system Pods need the most checks
  2. BMove the webhook server itself into kube-system
  3. CAvoid matching them, using selectors to protect critical workloads
  4. DUse a long timeout for them so that system Pods are never rejected by mistake
Show the answer and why
  • AMatch all of them, since system Pods need the most checks

    Incorrect

    Matching kube-system objects risks breaking critical components; the guidance says to avoid it.

  • BMove the webhook server itself into kube-system

    Incorrect

    Where the server runs does not address matching critical system objects.

  • CAvoid matching them, using selectors to protect critical workloads

    Correct

    The good practices say to avoid matching objects in kube-system and, for your own Pods there, to use an objectSelector so critical workloads are not mutated.

  • DUse a long timeout for them so that system Pods are never rejected by mistake

    Incorrect

    The guidance recommends small timeouts for webhooks.

Webhooks that intercept kube-system objects can disrupt critical cluster components. The good practices advise excluding kube-system, using namespace or object selectors, and keeping webhook timeouts small.

Practice domain 5 →Practice all domains →