CKS Supply Chain Security Practice Question
An admin runs 'kubectl run nginx --image=nginx' and the pod fails with 'ImagePullBackOff'. The cluster has an OPA/Gatekeeper constraint that only allows images from 'myregistry.io'. How can the admin quickly test the restriction?
⚠ Common exam trap
A common misconception is that '--validate=false' bypasses admission controllers, but it only affects client-side validation and has no effect on server-side webhooks like OPA/Gatekeeper.
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
✓
Use an image from 'myregistry.io/nginx:latest'
The OPA/Gatekeeper constraint explicitly restricts allowed images to those from 'myregistry.io'. By specifying an image from that registry (e.g., 'myregistry.io/nginx:latest'), the admin can quickly verify that the constraint permits compliant images. This tests the policy's intended behavior without altering or bypassing the constraint.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Delete the OPA constraint
Why it's wrong here
Deleting the OPA constraint removes the admission control policy instead of testing whether the pod complies; this changes the cluster's security posture rather than validating the constraint's logic. It only allows the pod because the policy no longer exists, not because the container image is permitted, and the deletion itself may be blocked by RBAC or flagged by audit logging.
- ✗
Add a label 'allowlist=true' to the pod
Why it's wrong here
OPA/Gatekeeper constraints evaluate the admission review request based on the object's spec fields, such as the container image reference, not arbitrary pod labels. Unless the constraint template explicitly references 'allowlist=true' as an exemption condition, adding this label has no effect on the admission decision, so the original image from the public Docker Hub would still violate the image allowlist policy.
- ✓
Use an image from 'myregistry.io/nginx:latest'
Why this is correct
If the OPA constraint's allowlist pattern permits images from 'myregistry.io', then specifying 'myregistry.io/nginx:latest' properly satisfies the image provenance check. The policy inspects the image field in the Pod spec and, if the registry matches the allowed pattern, the admission review passes; this is the correct way to test a compliance requirement without circumventing the control.
- ✗
Use 'kubectl run nginx --image=nginx --validate=false'
Why it's wrong here
The '--validate=false' flag in kubectl only disables client-side schema validation against the API's OpenAPI specification; it does not affect server-side admission webhooks. The pod creation request is still sent to the API server, where the OPA constraint is enforced, so the image would still be rejected if it does not match the registry allowlist.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKS question from scratch — 845 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.