Cannot select annotation key using jsonpath #31984
Labels
area/kubectl
kind/bug
Categorizes issue or PR as related to a bug.
priority/backlog
Higher priority than priority/awaiting-more-evidence.
I love using
kubectl ... -o jsonpath
but I cannot figure out how to print an annotation that contains a special character like-
or/
or.
.This does not work:
kubectl get pods tmp -o 'jsonpath={.metadata.annotations.kubernetes.io/created-by}{"\n"}'
nor this:
kubectl get pods tmp -o 'jsonpath={.metadata.annotations.kubernetes\.io\/created\-by}{"\n"}'
nor this:
kubectl get pods tmp -o 'jsonpath={.metadata.annotations}{["kubernetes.io/created-by"]}{"\n"}'
nor this:
kubectl get pods tmp-1986694738-dhpx0 -o jsonpath="{$['metadata']['annotations']['kubernetes.io/created-by']}"
(the last one should work according to what I can find about jsonPath, but doesn't, and anyhow is hard to get shell escaping right for.
Need a way to quote a
The text was updated successfully, but these errors were encountered: