I have a kubernetes cluster perfectly working fine. I use below command to get the status of all the pods running in my namespace dataspace
kubectl get pods -n dataspace -o wide | sort -k7
Above command gives me the output with below columns.
NAME READY STATUS RESTARTS AGE IP NODE
deployment-qw3ed 3/3 Running 3 3d 10.38.0.10 MACHINE01
Can we adjust above command so that the output looks like below. NODE
column should come after the STATUS
:
NAME READY STATUS NODE RESTARTS AGE IP
deployment-qw3ed 3/3 Running MACHINE01 3 3d 10.38.0.10
You can re-arrange the output with awk
which loses the pretty column separation but you can then make it pretty again with column
:
kubectl get pods -n dataspace -o wide | sort -k7 | awk '{ print $1, $2, $3, $7, $4, $5, $6}' | column -t