Hey guys I bet many has this question too. How to get list of pods with names, w . . .

Alex Novik:
Hey guys I bet many has this question too.
How to get list of pods with names, which node it allocated to, and images without using jsonpath. It is possible! Check this out:

kubectl get pods -o custom-columns=PODNAME:.metadata.name,NODENAME:.spec.nodeName,IMAGE:.spec..image
controlplane $ kubectl get pods -o custom-columns=PODNAME:.metadata.name,NODENAME:.spec.nodeName,IMAGE:.spec..image
PODNAME                     NODENAME   IMAGE
webserver-c9584bdf5-2blqt   node01     nginx:1.19
webserver-c9584bdf5-2gtrq   node01     nginx:1.19
webserver-c9584bdf5-4sjkx   node01     nginx:1.19
webserver-c9584bdf5-4v5v6   node01     nginx:1.19
webserver-c9584bdf5-6xhth   node01     nginx:1.19
webserver-c9584bdf5-6xwft   node01     nginx:1.19
webserver-c9584bdf5-hhqhx   node01     nginx:1.19
webserver-c9584bdf5-kz2t8   node01     nginx:1.19
webserver-c9584bdf5-ldg7z   node01     nginx:1.19
webserver-c9584bdf5-mzhxx   node01     nginx:1.19
webserver-c9584bdf5-vg7zz   node01     nginx:1.19
webserver-c9584bdf5-vzm2z   node01     nginx:1.19
webserver-c9584bdf5-xhxj7   node01     nginx:1.19
webserver-c9584bdf5-xxtl5   node01     nginx:1.19
webserver-c9584bdf5-zpf9j   node01     nginx:1.19

If you want to save it to a file without headers then just add a parameter --no-headers
it is much easier to understand than jsonpath I think, it follows the same structure as YAML, and json
So in preparation of your custom output table, just get configuration using command:
kubectl get pods -oyaml or -ojson and follow parenthesis
Collumn names may have any name you want

Jesus Arechiga Jimenez:
try kubectl get pods -o wide --no-headers

Jesus Arechiga Jimenez:
if that gets you what you need and now want to save to a file:
kubectl get pods -o wide --no-headers > filename.txt

Jesus Arechiga Jimenez:
but yes, custom colums are the best

Alex Novik:
you will not get image information with -o wide for example without custom collumns

Alistair Mackay:
I wrote this up :slightly_smiling_face:
https://github.com/kodekloudhub/community-faq/blob/main/docs/jsonpath.md

Tommy:
try command: kubectl get pods --no-headers -o custom-columns=":metadata.name"

Alex Novik:
@Alistair Mackay thats awesome, thanks!