Bird
0
0

What will be the output of kubectl get svc myservice -o jsonpath='{.spec.clusterIP}' if the service myservice exists?

medium📝 Command Output Q5 of 15
Kubernetes - Services
What will be the output of kubectl get svc myservice -o jsonpath='{.spec.clusterIP}' if the service myservice exists?
AThe service name 'myservice'
BAn error message
CThe namespace of the service
DAn IP address like 10.96.0.1
Step-by-Step Solution
Solution:
  1. Step 1: Understand jsonpath query

    The query extracts the clusterIP field from the service spec, which is the service's IP address.
  2. Step 2: Identify expected output

    If the service exists, it returns an IP like 10.96.0.1, not the name or namespace.
  3. Final Answer:

    An IP address like 10.96.0.1 -> Option D
  4. Quick Check:

    jsonpath clusterIP returns service IP [OK]
Quick Trick: clusterIP field holds the service IP address [OK]
Common Mistakes:
  • Expecting service name instead of IP
  • Confusing namespace with clusterIP
  • Misusing jsonpath syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes