0

able to list all pods and IP with this command

kubectl get po -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}' 

but trying to get a podIP of a pod with a podname. How to retrieve the podIP which met the condition of pod name. Appreciate any help here.

  • Does this answer your question? [How do I get the pod ID in Kubernetes?](https://stackoverflow.com/questions/57799684/how-do-i-get-the-pod-id-in-kubernetes) – Pit Jun 29 '21 at 08:45

1 Answers1

0

You could add a specific pod name and namespace to your kubectl command.

kubectl get po $POD_NAME -n $NAMESPACE -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'

Emre Odabaş
  • 409
  • 3
  • 6