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
CodePudding user response:
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
.
CodePudding user response:
Try this:
kubectl get po -o jsonpath='{range .items[*]}{@.spec.containers[*].name}{" "}{@.metadata.namespace}{"\n"}{end}'