kubernetes获取所有POD的IP信息

kubectl get pods -n xxxx -o=custom-columns=NAME:.metadata.name,Node-IP:.status.hostIP,Pod-IP:.status.podIP

NAME                                 Node-IP       Pod-IP
xxxx-6bb9d78f8-5v557                 10.xx.0.x     xx.28.18.xx
xxxx-6bb9d78f8-7b9t2                 10.xx.0.xx    xx.28.23.xx
xxxx-6bb9d78f8-7l4zq                 10.xx.x.xx    xx.xx.10.xx

#获取整个k8s node和podip关联信息,命令如下
kubectl get pods --all-namespaces -o=custom-columns=NAME:.metadata.name,Node-IP:.status.hostIP,Pod-IP:.status.podIP

此处采用kubectl自定义列获取整个k8s的pod和nodeip

要定义自定义列并仅将所需的详细信息输出到表中,可以使用该 custom-columns 选项。你可以选择内联定义自定义列或使用模板文件:-o=custom-columns= 或 -o=custom-columns-file=

相关文档参考:kubectl 概述 | Kubernetes

你可能感兴趣的:(kubernetes,kubernetes,容器,k8s)