Tangible Bytes

A Web Developer’s Blog

Kubectrl Custom Columns

Kubernetes provides a wide variety of methods for formatting output

The custom columns output lets you print multiple values defined using jsonpath expressions in a tabular output

While outputting scalar values is reasonably intuitive, I couldn’t see in the docs where is says what the format for defining custom-columns is.

-o custom-columns=<spec> Print a table using a comma separated list of custom columns.

Once I understood it was jsonpath, accessing something like an array of hosts from my ingresses worked nicely

kubectl get -A ingresses -o custom-columns=\
Hosts:.spec.rules[*].host,Name:.metadata.name,NameSpace:.metadata.namespace