I'm looking to pull out json information from a yaml file in kubernetes to specifically get the version of the image I'm using. Any help would be awesome.
command I'm using right now is
kubectl get statefulset -n namespace -o=jsonpath='{$.spec.template.spec.initcontainers[:1].image}'
Did you try using item?
-o jsonpath='{.items[*].spec.template.spec.initcontainers[:1].image}'
This was the solution:
kubectl get statefulset -n namespace -o=jsonpath='{$.spec.template.spec.containers[*].image}'
This also worked:
kubectl get statefulset -n namespace -o=jsonpath='{$.spec.template.spec.containers[:1].image}'