A Deployment named market-api and a Service with the same name are running in anatomy-v9pho.
sh
kubectl get deploy,svc -n anatomy-v9phoFull object
sh
kubectl get deploy market-api -n anatomy-v9pho -o yamlRead spec.template.spec.containers. It has one container. Note its image (no tag means latest) and the containerPort under ports.
One value
jsonpath prints exactly one path. These two lines answer two objectives:
sh
kubectl get deploy market-api -n anatomy-v9pho -o jsonpath='{.spec.template.spec.containers[0].image}'
kubectl get deploy market-api -n anatomy-v9pho -o jsonpath='{.spec.template.spec.containers[0].ports[0].containerPort}'The Service finds its Pods through spec.selector:
sh
kubectl get svc market-api -n anatomy-v9pho -o jsonpath='{.spec.selector}'The schema
The Deployment template never mentions restartPolicy, yet every Pod has one. explain tells you the default:
sh
kubectl explain pod.spec.restartPolicyWrite something
Labels are part of metadata, and metadata is yours to edit. Tag the Deployment with the team that owns it:
sh
kubectl label deploy market-api team=platform -n anatomy-v9pho
kubectl get deploy market-api -n anatomy-v9pho --show-labels