Formatting kubectl output

1/22/2018

I'm trying to format the output of this command:

kubectl get pods test

like docker I'm trying to format the outout just for it to print me the name and the status of all pods. docker:

docker ps --format "{{.Status}},{{.Name}}"

Any way I can do it?

-- Itay Gil
docker
formatting
kubernetes

1 Answer

1/22/2018

You can do that with custom columns:

kubectl get pods -o=custom-columns=STATUS:.status.phase,STARTED:.status.startTime,NAME:.metadata.name
-- nickgryg
Source: StackOverflow