StenlyTU / K8s-training-official

The goal of this tutorial is to give you a good understanding of Kubernetes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question 47 - List the InternalIP of all nodes of the cluster.

alochym01 opened this issue · comments

your suggestion is using jsonpath. Can you show me the cli to do that
for me, i resolved it by using custom-columns

hadn@master-1:~/github/StenlyTU/pod$ kubectl get node -o custom-columns="IP:.status.addresses[0].address, TYPE:.status.addresses[0].type"
IP               TYPE
192.168.2.150   InternalIP
192.168.2.20    InternalIP

You can do it like this:

➜ ~ kubectl get nodes -o jsonpath='{..addresses[?(@.type=="InternalIP")].address}'
10.250.3.151