
Explanation:
The correct answer is D because kubectl get svc retrieves the service data, and jsonpath is used to parse the data specifically for the IP address. This method is documented in Kubernetes resources for extracting specific information from services. For example, to access services, you might use the external IP and application port as shown in Kubernetes tutorials.
Ultimate access to all questions.
No comments yet.
You're tasked with creating a script to extract the IP address of a Kubernetes Service. A coworker has shared a code snippet they believe could help. Which option would be the most effective starting point for your code?
A
kubectl get svc -o html
B
kubectl get svc
C
kubectl get svc -o filtered-json='{.items[*].status.loadBalancer.ingress[0].ip}'
D
kubectl get svc -o jsonpath='{.items[*].status.loadBalancer.ingress[0].ip}'