I use kubectl
to list Kubernetes custom resources of a kind mykind
with an additional table column LABEL
that contains the value of a label a.b.c.com/key
if present:
kubectl get mykind -o=custom-columns=LABEL:.metadata.labels.'a\.b\.c\.com/key'
This works, i.e., the label value is properly displayed.
Subsequently, I wanted to add a corresponding additional printer column to the custom resource definition of mykind
:
- description: Label value
jsonPath: .metadata.labels.'a\.b\.c\.com/key'
name: LABEL
type: string
Although the additional column is added to kubectl get mykind
, it is empty and no label value is shown (in contrast to above kubectl
command). My only suspicion were problems with escaping of the special characters - but no variation helped.
Are you aware of any difference between the JSON path handling in kubectl
and additional printer columns? I expected strongly that they are exactly the same.