Skip to content

Instantly share code, notes, and snippets.

@alces
Created September 10, 2024 12:59
Show Gist options
  • Save alces/7f06eea273d63d4fd874b1e2d77d6fa4 to your computer and use it in GitHub Desktop.
Save alces/7f06eea273d63d4fd874b1e2d77d6fa4 to your computer and use it in GitHub Desktop.

Revisions

  1. alces created this gist Sep 10, 2024.
    7 changes: 7 additions & 0 deletions find_pods_by_image_id.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/bin/bash -e

    # Find all the pods using a given imageID

    kubectl get pods --all-namespaces \
    -o 'custom-columns=NS:.metadata.namespace,NAME:.metadata.name,IMAGE:.status.containerStatuses[*].imageID' |
    awk '{if ($3 ~ "bitnami/external-dns@sha256:b615d1c97d93e5a4d83da00de8d1854f0274814b4ef57708d0ed9341205753e9") {print $1 "/" $2}}'