This Markdown file is a collection of helpful kubectl
commands that I repeadetly finding myself using.
- Print the name of every container in a pod on a newline:
kubectl get pod -n <namespace> <podname> -o jsonpath='{range .spec.containers[*]}{.name}{"\n"}{end}'
- Print the name of every container (and its image) found inside of a pod:
kubectl get pod -n -o jsonpath='{range .spec.containers[*]}{.name}{" | "}{.image}{"\n"}{end}