For example:
command
kgp -o jsonpath='{range .items[]}{range @.spec.containers[]}{@.name}{"t"}{.items[].metadata.name}{"n"}{end}{"n"}{end}’
output
- nginx
- istio-proxy
- sidecar-1
expected output
- nginx default
- istio-proxy default
- sidecar-1 default
For example:
command
kgp -o jsonpath='{range .items[]}{range @.spec.containers[]}{@.name}{"t"}{.items[].metadata.name}{"n"}{end}{"n"}{end}’
output
expected output
2
Answers
I think you want to print the pattern
podname namespace
. Is that right? Then you have to change.items[].metadata.name
to.items[].metadata.namespace
.Try this: