Courseiva
Question 557 of 720
Minimize Microservice VulnerabilitieseasyMultiple ChoiceObjective-mapped

CKS Minimize Microservice Vulnerabilities Practice Question

Which command creates a validating webhook configuration that checks all pods in the cluster?

⚠ Common exam trap

The CKS exam often tests the distinction between mutating and validating webhooks. Candidates may confuse `kubectl create mutatingwebhookconfiguration` with the validating variant, or assume `kubectl apply` with a flag can create a validating webhook.

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

kubectl create validatingwebhookconfiguration my-webhook --from-file=webhook.yaml

`kubectl create validatingwebhookconfiguration` is the specific command to create a ValidatingWebhookConfiguration resource from a YAML file, which can be configured to intercept and validate pod creation requests across the cluster. This resource allows you to define a webhook that checks all pods before they are admitted, enforcing custom validation logic.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • kubectl create mutatingwebhookconfiguration my-webhook --from-file=webhook.yaml

    Why it's wrong here

    This creates a mutating webhook, not a validating one.

  • kubectl run webhook --image=webhook

    Why it's wrong here

    This runs a pod, not a webhook configuration.

  • kubectl create validatingwebhookconfiguration my-webhook --from-file=webhook.yaml

    Why this is correct

    Correct.

  • kubectl apply -f webhook.yaml --validating

    Why it's wrong here

    There is no --validating flag.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.