Custom-columns not producing comma-separated list

When I use -o custom-columns, I get a nice tabular format. But the documentation claims I should get comma-separated values (which is what I want in this case):

$ kubectl get statefulsets --all-namespaces -o custom-columns="NAMESPACE:metadata.namespace,NAME:metadata.name,REPLICAS:status.replicas"
NAMESPACE    NAME    REPLICAS
sample               mytest   1

etc.

I see that the test cases in the source code only tests showing a single column, so it doesn’t check the output format.

Cluster information:

Kubernetes version: 1.16.11-gke.5, 1.16.13-gke.1
Cloud being used: (put bare-metal if not on a public cloud) GKE

This is from the docs:

Print a table using a comma separated list of custom columns.

I think it’s saying using the following comma separated list of columns, print a table with those columns.
You may have to output to json and use jq to get comma separated.

Kind regards,
Stephen

1 Like