CKS Minimize Microservice Vulnerabilities Practice Question
A Gatekeeper Constraint is not blocking pods that violate the policy. The constraint references a ConstraintTemplate that has been successfully created. What is the most likely cause?
⚠ Common exam trap
A common trap is the misconception that a missing `match` field or namespace mismatch causes a constraint to be ineffective, but the real trap is that `enforcementAction: dryrun` silently allows violations while appearing to be correctly configured.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The Constraint has 'enforcementAction: dryrun'
When a Gatekeeper Constraint has `enforcementAction: dryrun`, it logs violations but does not block pod creation or updates. This is the most likely cause because the constraint is correctly configured and the ConstraintTemplate exists, but the enforcement action is set to dryrun instead of the default `deny`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The Constraint is missing the 'match' field
Why it's wrong here
A Constraint lacking the `match` field does not silently fail to enforce; rather, Gatekeeper's schema validation typically rejects the resource because `match` is a required field in the Constraint spec. In the unlikely event it were accepted, the default behavior would match no resources, meaning zero Pods are selected for evaluation. Either way, the Constraint would either never be created (visible in the cluster) or would be inert — not a hidden cause of non-blocking while the Constraint looks active. Therefore, the missing `match` field would produce an obvious failure, not a subtle dryrun-like behavior.
- ✓
The Constraint has 'enforcementAction: dryrun'
Why this is correct
This is the correct cause: setting `enforcementAction: dryrun` explicitly tells OPA Gatekeeper to run its evaluation and log any violations to the audit status, but to never reject the admission request. The default enforcement action for a Constraint is `deny`, which blocks the request, but overriding it with `dryrun` disables that blocking while keeping the rule visible in reports. In this mode, deploying a violating Pod will succeed, and the violation will only appear as a status entry or in logs — precisely the symptom described. Fixing this requires changing the value to `deny` (or removing the field entirely) to activate active enforcement.
- ✗
The Constraint is in a different namespace than the pods
Why it's wrong here
Gatekeeper Constraints are cluster-scoped custom resources, not namespaced objects, so their physical placement in a namespace has no effect on which resources they apply to. Namespace selection is handled by the `match` field inside the Constraint's spec, which can target specific namespaces (or exclude them) via `namespaces` or `namespaceSelector`. Placing the Constraint in a particular namespace does not limit or redirect its enforcement scope; it is visible and evaluated for all Pods in all namespaces. Therefore, a namespace mismatch cannot explain why violating Pods are being allowed, because the Constraint's namespace is irrelevant to its enforcement.
- ✗
The ConstraintTemplate is missing the 'violation' rule
Why it's wrong here
A ConstraintTemplate defines the Rego policy logic, and the mandatory entry point is a rule named `violation` (e.g., `violation[violation] { ... }`). If this rule is omitted, the template is malformed and the Gatekeeper controller will reject it, so no actual Constraints can be created from that template. The user would see a clear error in the Template's status, and the Constraint itself would not exist — thus it cannot be responsible for letting violating Pods through. Since the Constraint in question is apparently present (it is just not blocking), a missing `violation` rule would have prevented its creation altogether, making this option inconsistent with the observed symptom.
Go deeper
Related to this question
About these practice questions
This CKS question is part of Courseiva's 845-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.