Skip to content

Instantly share code, notes, and snippets.

@chulkilee
Created September 23, 2024 04:18
Show Gist options
  • Save chulkilee/a13f971dafd7fa5387f97f0b4162d691 to your computer and use it in GitHub Desktop.
Save chulkilee/a13f971dafd7fa5387f97f0b4162d691 to your computer and use it in GitHub Desktop.
#!/bin/bash -u
k8s_context=$1
# https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/
images=$(kubectl --context $1 get pods --all-namespaces -o jsonpath="{.items[*].spec['initContainers', 'containers'][*].image}" \
| tr -s '[[:space:]]' '\n' \
| sort \
| uniq)
for image in $images; do
crane manifest "$image" > /dev/null 2>&1 && echo "$image: OK" || echo "$image: ERROR"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment