Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stewartshea/bc24be721d9a3c825d3334e060527bc7 to your computer and use it in GitHub Desktop.
Save stewartshea/bc24be721d9a3c825d3334e060527bc7 to your computer and use it in GitHub Desktop.
List Images and Tags for Every Container in Running Pods
kubectl get pods --context=${CONTEXT} -n ${NAMESPACE} --field-selector=status.phase==Running -o=json | jq -r '.items[] | "---", "pod_name: " + .metadata.name, "Status: " + .status.phase, "containers:", (.spec.containers[] | "- container_name: " + .name, " image_path: " + (.image | split(":")[0]), " image_tag: " + (.image | split(":")[1])), "---"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment