Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active October 3, 2024 02:29
Show Gist options
  • Select an option

  • Save zulhfreelancer/5446c3cc4fae527ed5f4af4f044e7557 to your computer and use it in GitHub Desktop.

Select an option

Save zulhfreelancer/5446c3cc4fae527ed5f4af4f044e7557 to your computer and use it in GitHub Desktop.

Revisions

  1. zulhfreelancer revised this gist Oct 3, 2024. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions find-pod-by-uid.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,12 @@ kubectl get pods -A -o json | jq -r '.items[] | select(.metadata.uid == "<UID>")

    ```
    kubectl get pods -A -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,UID:.metadata.uid | grep <UID>
    ```

    ### Option #3

    > If you're using Docker, run this on _each_ node
    ```
    docker ps -a --format '{{.Names}}' | grep <UID>
    ```
  2. zulhfreelancer created this gist Oct 3, 2024.
    13 changes: 13 additions & 0 deletions find-pod-by-uid.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    ## How to find a pod by UID?

    ### Option #1

    ```
    kubectl get pods -A -o json | jq -r '.items[] | select(.metadata.uid == "<UID>") | .metadata.name, .metadata.namespace'
    ```

    ### Option #2

    ```
    kubectl get pods -A -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,UID:.metadata.uid | grep <UID>
    ```