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.

https://kubernetes.io/blog/2023/03/10/image-registry-redirect

Follow our social media:

https://www.linkedin.com/in/ssbostan

https://www.linkedin.com/company/kubedemy

https://www.youtube.com/@kubedemy

https://telegram.me/kubedemy


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.

https://kubernetes.io/docs/tasks/configure-pod-container/static-pod

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

One Comment

Leave a Reply

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