Bird
0
0

Given this command: kubectl get serviceaccount default -o jsonpath='{.secrets[0].name}', what does it output?

medium📝 Command Output Q13 of 15
Kubernetes - RBAC and Security
Given this command: kubectl get serviceaccount default -o jsonpath='{.secrets[0].name}', what does it output?
AThe name of the first secret linked to the default ServiceAccount
BThe list of all pods using the default ServiceAccount
CThe token value inside the secret
DAn error because jsonpath is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command structure

    The command fetches the ServiceAccount named 'default' and extracts the first secret's name using jsonpath.
  2. Step 2: Interpret the jsonpath expression

    The expression {.secrets[0].name} selects the name of the first secret linked to the ServiceAccount.
  3. Final Answer:

    The name of the first secret linked to the default ServiceAccount -> Option A
  4. Quick Check:

    jsonpath extracts secret name from ServiceAccount [OK]
Quick Trick: jsonpath {.secrets[0].name} gets first secret name [OK]
Common Mistakes:
  • Thinking it lists pods instead of secrets
  • Expecting secret token value instead of secret name
  • Assuming jsonpath syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes