Page cover image

JSONPATH

JSON PATH in Kubectl

kubectl get pods -o json

To get the image in JSON path query:

kubectl get pods -o jsonpath=.items[0].spec.containers[0].image

Custom Columns

kubectl get nodes -o=custom-columns=<COLUMN_NAME>:<JSON PATH>
kubectl get nodes -o=custom-columns=NODE:.metadata.name,CPU:status.capacity.cpu

Sort By

To sort based on name:

kubectl get nodes --sort-by=.metadata.name

Last updated