Last active
April 8, 2021 07:14
-
-
Save davidalger/e500dc8e5f0e642a30e8f21caef74406 to your computer and use it in GitHub Desktop.
List all non-Google/GKE/k8s/Stackdriver images in a cluster using fully qualified names and without tags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
kubectl get all --all-namespaces -o yaml \ | |
| grep \ image: \ | |
| egrep -iv 'image:\ sha256|(gke|k8s)\.gcr\.io|gcr\.io/(gke|google|stackdriver|kubernetes)-.*' \ | |
| perl -pe 's#^[\W-]+image:\W+([^\@:]+)([:@].+)?$#$1#i' \ | |
| perl -pe 's#^([a-z0-9-_]+)$#docker.io/library/$1#i' \ | |
| perl -pe 's#^([a-z0-9-_/]+)$#docker.io/$1#i' \ | |
| sort -n | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To install for use with Krew:
To run it: