Bird
0
0

You want to write a YAML file for a Service resource and need to understand the spec.ports field. Which command will give you detailed information about this field and its subfields?

hard📝 Best Practice Q15 of 15
Kubernetes - kubectl Essential Commands
You want to write a YAML file for a Service resource and need to understand the spec.ports field. Which command will give you detailed information about this field and its subfields?
Akubectl explain service.spec.ports --verbose
Bkubectl explain service.spec.ports --all
Ckubectl explain service.spec.ports --details
Dkubectl explain service.spec.ports --recursive
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct flag for nested details

    The --recursive flag shows detailed info about the field and all nested subfields.
  2. Step 2: Verify other options

    Flags like --all, --details, or --verbose are not valid for kubectl explain.
  3. Final Answer:

    kubectl explain service.spec.ports --recursive -> Option D
  4. Quick Check:

    Use --recursive to see nested field details [OK]
Quick Trick: Add --recursive to see all nested fields explained [OK]
Common Mistakes:
  • Using invalid flags like --all or --verbose
  • Not using --recursive and missing subfield info
  • Confusing kubectl explain with kubectl get

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes