Not able to fetch ip address of pods using Kubectl and jsonpath Not able to fetch ip address of pods using Kubectl and jsonpath kubernetes kubernetes

Not able to fetch ip address of pods using Kubectl and jsonpath


If you have multiple Pods with the same label, you get a list of Pods. You have to adjust your jsonpath to -o jsonpath="{.items[*].status.podIP}" to get all the podIPs.


According to the official doc, you can add custom columns when querying a list of resources.

So you can do kubectl get pods -l app=validate -n {namespace_name} -o custom-columns=ip:.status.podIP