kubernetes / community

Kubernetes community content

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interaction between kubctl "-o custom-columns=" and "--sort-by=" generates error

dsorak opened this issue · comments

Describe the issue

When I try to combine the options, I get an error:

$ kubectl get pods -A -o custom-columns='NAMESPACE:.metadata.namespace,NAME:.metadata.name' --sort-by='{.metadata.namespace},{.metadata.name}'
error: unexpected path string, expected a 'name1.name2' or '.name1.name2' or '{name1.name2}' or '{.name1.name2}'

Each option operates correctly when used individually, but when combined, I get the error. I have tried reversing the order of options, but I get the same error.

I just noticed, that the following does not cause an error, but also does not sort by the second property reference, {.metadata.name}:

kubectl get pods -A --sort-by='{.metadata.namespace},{.metadata.name}'

/sig cli