CKS Minimize Microservice Vulnerabilities Practice Question
You need to set up a ValidatingWebhookConfiguration to deny pods that run as root. The webhook server is deployed in the 'webhook' namespace with service 'webhook-svc' on port 443. Which of the following is a correct snippet for the webhook configuration?
⚠ Common exam trap
A common pitfall is assuming that a `caBundle` is always mandatory when using a `service` reference. In fact, if the webhook server's certificate is signed by the cluster's CA (as is typical for in-cluster services), the API server can use its own CA bundle, making `caBundle` optional. Another trap is using a raw IP or service DNS name in the `url` field instead of a proper `service` reference, or omitting the `port` field when using a `service` reference.
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
✓
clientConfig: service: name: webhook-svc namespace: webhook path: /validate port: 443
It properly defines a service reference with the required fields: name, namespace, and path. The port field is explicitly set to 443, matching the webhook server's listening port. In Kubernetes, when using a service reference and the webhook server's certificate is signed by the cluster's CA (which is typical for in-cluster services), the caBundle field may be omitted as the API server can use its own CA bundle to verify the connection. Thus, the configuration in A is complete and valid for this scenario.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
clientConfig: service: name: webhook-svc namespace: webhook path: /validate port: 443
Why this is correct
This correctly references the service within the cluster.
- ✗
clientConfig: url: https://10.96.0.1:443/validate
Why it's wrong here
Using hardcoded IP is not recommended due to changes; service DNS is preferred.
- ✗
clientConfig: url: https://webhook-svc.webhook.svc:443/validate
Why it's wrong here
Using 'url' is possible but not the preferred method; also, the URL scheme should be 'https'.
- ✗
clientConfig: service: name: webhook-svc namespace: webhook path: /validate caBundle: <base64>
Why it's wrong here
Missing the 'port' field; default is 443 but explicit is better; also caBundle is required but not shown.
Go deeper
Related to this question
About these practice questions
This CKS question is part of Courseiva's 114-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 →
Same concept, more angles
1 more way this is tested on CKS
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. You are deploying a ValidatingWebhookConfiguration. The webhook server is running in the 'webhook' namespace, service name 'svc', port 443. Which clientConfig should you specify?
hard- ✓ A.clientConfig: service: namespace: webhook name: svc path: /validate
- B.clientConfig: url: https://webhook.svc.cluster.local:443/validate
- C.clientConfig: service: namespace: webhook name: webhook path: /validate
- D.clientConfig: service: namespace: default name: svc path: /validate
Why A: A ValidatingWebhookConfiguration's clientConfig must reference the Kubernetes service that fronts the webhook server, specifying the service's namespace, name, and the path to the validation endpoint. Since the webhook server runs in the 'webhook' namespace with service name 'svc' on port 443, the service reference must use namespace: webhook and name: svc, with path: /validate. Kubernetes automatically resolves the service to its cluster-internal DNS name and uses the service's HTTPS port (443) when a service reference is provided.
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.