Bird
0
0

Which of the following is the correct way to label a namespace to enforce the 'restricted' Pod Security Standard in Kubernetes?

easy📝 Configuration Q12 of 15
Kubernetes - RBAC and Security
Which of the following is the correct way to label a namespace to enforce the 'restricted' Pod Security Standard in Kubernetes?
Akubectl set security namespace myns restricted
Bkubectl label pod mypod pod-security.kubernetes.io/enforce=restricted
Ckubectl annotate namespace myns pod-security.kubernetes.io/enforce=restricted
Dkubectl label namespace myns pod-security.kubernetes.io/enforce=restricted
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct resource and command

    Pod Security Standards are enforced by labeling namespaces, not pods.
  2. Step 2: Check correct syntax for labeling namespace

    The correct command is 'kubectl label namespace pod-security.kubernetes.io/enforce=restricted'.
  3. Final Answer:

    kubectl label namespace myns pod-security.kubernetes.io/enforce=restricted -> Option D
  4. Quick Check:

    Label namespace with enforce=restricted [OK]
Quick Trick: Label namespaces, not pods, to enforce Pod Security Standards [OK]
Common Mistakes:
  • Labeling pods instead of namespaces
  • Using annotate instead of label
  • Using invalid kubectl commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes