Minikube 报告 “Authentication is required” 有 20 张图像中的 1 张。

huangapple go评论65阅读模式
英文:

Minikube reports "Authentication is required" for 1 out of 20 images

问题

好的,以下是翻译好的部分:

"Okay, so I have a Minikube setup and deploying a Helm chart. This chart pulls mainly from one repo where I need to authenticate.
我有一个Minikube环境,并部署了一个Helm图表。这个图表主要从一个需要身份验证的仓库中拉取。

I do a kubectl create secret for that repo and most of the images are pulling fine. Just one (always the same) doesn't get pulled with an error Authentication is required.
我使用kubectl create secret为该仓库创建了一个密钥,并且大多数镜像都能够正常拉取。只有一个(始终相同)出现了错误,提示需要身份验证。

How can I find out why this exact image is failing and all others from the same repo (same authentication and everything) work fine?
我如何找出为什么这个特定的镜像失败,而来自同一仓库的所有其他镜像(具有相同的身份验证和一切)都能正常工作?

BTW: When I do a docker login and docker pull inside of the Minikube container everything works fine as well...
顺便说一下:当我在Minikube容器内部执行docker logindocker pull时,一切都正常工作..."

英文:

Okay, so I have a Minikube setup and deploying a Helm chart. This chart pulls mainly from one repo where I need to authenticate.

I do a kubectl create secret for that repo and most of the images are pulling fine. Just one (always the same) doesn't get pulled with an error Authentication is required.

How can I find out why this exact image is failing and all others from the same repo (same authentication and everything) work fine?

BTW: When I do a docker login and docker pull inside of the Minikube container everything works fine as well...

答案1

得分: 0

由于错误显示图像“需要身份验证”,该图像可能是私有图像。要解决此问题,您可以使用“kubectl create secret docker-registry”命令创建一个拉取密钥,并将其添加到您的服务帐户的拉取密钥列表中,或者直接将其添加到使用“imagePullSecrets”列表的部署中。

使用Kubectl将您的密钥应用到您的集群:

Kubectl apply -f image-pull-secret.yaml

现在,您必须更新您的Pod清单,以指示Kubernetes在获取图像时使用创建的密钥:

apiVersion: v1
kind: Pod
metadata:
    name: example
spec:
    containers:
        - name: example
          image: registry.example.com/example-image:latest
    imagePullSecrets:
        - name: image-pull-secret

将更新后的Pod清单应用到您的集群。下一次拉取尝试现在应该成功。Kubernetes将能够对注册表进行身份验证并下载图像。

请注意,当您使用身份验证但指定无效的用户名或密码时,也可能会出现“拉取访问被拒绝”的错误的不同变体。在这种情况下,您应该检查Pod的imagePullSecrets,以确保它引用了正确的密钥。

您可以参考Austin DaweyJames Walker编写的文档,以获取有关故障排除imagePullSecrets的更多信息。

英文:

As the error shows the image requires authentication, the image might be a private image. To resolve this issue, you can create a pull secret using the “kubectl create secret docker-registry” command and add it to your service account’s list of pull secrets or add it directly to the deployment using the “imagePullSecrets” list.

Apply your secret to your cluster using Kubectl:

Kubectl apply -f image-pull-secret.yaml 

And now you must update your pod’s manifest to instruct Kubernetes to use the created secret when fetching the image

apiVersion: v1
kind: Pod
Metadata:
    name: example
Spec:
    Containers:
       - name: example
        image: registry.example.com/example-image:latest
    imagePullSecrets:
       - name: image-pull-secret

Apply the updated pod manifest to your cluster. The next pull attempt should now succeed. Kubernetes will be able to authenticate to the registry and download the image.

Beware that variations of the pull access denied error may also appear when you’re using authentication but specifying an invalid username or password. In this case, you should check the pod’s imagePullSecrets to make sure it’s referencing the correct secret.

You can refer to the documents written by Austin Dawey and James walker for more information on troubleshooting imagePullSecrets.

huangapple
  • 本文由 发表于 2023年6月1日 15:27:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379575.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定