Kubernetes: получить список всех подов на всех WorkerNodes

Автор |  18/08/2020
 
Вариант 1 – сортировка по имени рабочих нод

[simterm]

$ kubectl get pod -o=custom-columns=NODE:.spec.nodeName,NAME:.metadata.name --all-namespaces | sort
ip-10-3-42-245.us-east-2.compute.internal   aws-node-668rk
ip-10-3-42-245.us-east-2.compute.internal   coredns-5fb4bd6df8-znbzr
ip-10-3-42-245.us-east-2.compute.internal   gorush-5c6775748b-s6jkp
...

[/simterm]

Вариант 2 – сортировка по имени подов

[simterm]

$ kubectl get pod -o=custom-columns=NAME:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeName --all-namespaces
prometheus-prometheus-node-exporter-99z6w                    Running     ip-10-3-43-168.us-east-2.compute.internal
prometheus-prometheus-node-exporter-b47k9                    Running     ip-10-3-49-200.us-east-2.compute.internal
prometheus-prometheus-node-exporter-brfvk                    Running     ip-10-3-58-193.us-east-2.compute.internal
...

[/simterm]

Вариант 3 – только IP подов

[simterm]

$ kubectl get pod --all-namespaces -o json | jq '.items[] | .spec.nodeName + " " + .status.podIP' | tail
"ip-10-3-43-168.us-east-2.compute.internal 10.3.43.168"
"ip-10-3-49-200.us-east-2.compute.internal 10.3.49.200"
"ip-10-3-58-193.us-east-2.compute.internal 10.3.58.193"

[/simterm]


Категорія: