[*]
Answer
kubectl get pods POD_NAME_HERE -o jsonpath="{.spec.containers[*].name}"
Explanation
This gets the JSON object representing the pod. It then uses kubectl’s JSONpath to extract the name of each container from the pod.
[*]
kubectl get pods POD_NAME_HERE -o jsonpath="{.spec.containers[*].name}"
This gets the JSON object representing the pod. It then uses kubectl’s JSONpath to extract the name of each container from the pod.