[英]Why EKS pods referring to old artifactory image address?
We migrated our docker image artifactory from the self-hosted Nexus on EC2 to the ECR repository and updated the new image reference in all the deployments.我们将 docker 图像工件从 EC2 上的自托管 Nexus 迁移到 ECR 存储库,并更新了所有部署中的新图像引用。 But many times we observed that when the pod is recreated or deployment is restarted the pod fails with the imagepullbackoff error because it is referring to the old image reference which does not exist whereas its deployment contains the new image reference.
但很多时候我们观察到,当重新创建 pod 或重新启动部署时,pod 会失败并出现imagepullbackoff错误,因为它指的是不存在的旧图像引用,而其部署包含新图像引用。 Then we have to manually update the new image reference in the pod which is not the correct way.
然后我们必须手动更新 pod 中的新图像引用,这是不正确的方法。 Does anybody know why this behavior is happening?
有谁知道为什么会发生这种行为?
when changing the container image name or tag you would just scale your application to 0 and back to the original size means all pods will be deleted and recreated so image tags will be updated in every pod you can do it by:当更改容器图像名称或标签时,您只需将应用程序缩放为 0 并恢复到原始大小,这意味着所有 pod 都将被删除并重新创建,因此图像标签将在每个 pod 中更新,您可以通过以下方式完成:
kubectl scale --replicas=0 deployment my-deployment
Ensure you set ImagePullPolicy: Always
and kill each pod and have the deployment recreate it.确保设置
ImagePullPolicy: Always
并终止每个 pod 并让部署重新创建它。 this step is not required for local images.本地图像不需要此步骤。
Now update the image simple way is by using following command:现在更新图像的简单方法是使用以下命令:
kubectl set image deployment/my-deployment mycontainer=myimage
Now scale up the deployment using the below command ensure you have matched the replica count before and after updating image现在使用以下命令扩展部署,确保您在更新映像之前和之后匹配副本计数
kubectl scale --replicas=1 deployment application
Now check if imagepullbackoff error repeats now.现在检查imagepullbackoff错误是否再次出现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.