Kubernetes Hacks and Tricks – #6 Find Pods running from deprecated registry

      As you know, recently, Kubernetes changed its main repository from k8s.gcr.io to registry.k8s.io, meaning you should update your manifests as soon as possible. In this note, I tell you how to find running Pods using the legacy image registry.


      Follow our social media:





      This command lists all running Pods in your cluster, namespaces and their images:

      kubectl get po -A -o jsonpath='{range .items[*]}{"namespace="}{.metadata.namespace}{" "}{"pod="}{.metadata.name}{" "}{range .spec.containers[*]}{"image="}{.image}{" "}{end}{"\n"}{end}'

      Now, to find Pods using k8s.gcr.io, you can grep the result:

      kubectl get po -A -o jsonpath='{range .items[*]}{"namespace="}{.metadata.namespace}{" "}{"pod="}{.metadata.name}{" "}{range .spec.containers[*]}{"image="}{.image}{" "}{end}{"\n"}{end}' | grep k8s.gcr.io

      After finding target Pods, you can update the Deployment, ReplicaSet, DaemonSet, StatefulSet, etc. manifest to use the new Kubernetes image registry.

      Important note:
      This change from the Kubernetes community has nothing to do with your applications. In most cases, you need to update static Pods manifests from worker nodes – for example, Kube-apiserver Pod runs directly by Kubelet on the worker node.


      If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.

      Follow my LinkedIn https://www.linkedin.com/in/ssbostan

      Follow Kubedemy LinkedIn https://www.linkedin.com/company/kubedemy

      Follow Kubedemy Telegram https://telegram.me/kubedemy

      Hi, I’m Saeid Bostandoust

      Leave a Reply

      Your email address will not be published. Required fields are marked *