gpt4 book ai didi

google-cloud-platform - 无法从 Google 容器注册表将 docker 镜像拉入 Kubernetes Pod

转载 作者:行者123 更新时间:2023-12-02 05:34:09 26 4
gpt4 key购买 nike

我已阅读此 question 和此 one ,并使用具有项目:所有者和查看者权限的服务帐户 JSON key 为 Google 容器注册表创建了我的 Kubernetes key 。我还通过控制台验证了该镜像确实存在于 Google Container Registry 中。

我也读过这篇 document

当我运行时:

minikube dashboard

然后在用户界面中,单击“+”sybmol,指定图像的 URL,如下所示:

project-123456/bot-image

然后单击“高级选项”并指定导入的 Secret。

几秒钟后我看到这个错误:

Error: Status 403 trying to pull repository project-123456/bot-image: "Unable to access the repository: project-123456/bot-image; please verify that it exists and you have permission to access it (no valid credential was supplied)."

如果我查看 Secret 文件 (.dockerconfigjson) 的内容,就会发现:{"https://us.gcr.io ": {"email": "admin@domain.com", "auth": "longtexthere"}}

可能是什么问题?

最佳答案

json 需要有一个顶级 "{auths": json key from:

Creating image pull secret for google container registry that doesn't expire?

所以 json 的结构应该如下:

{"auths":{"https://us.gcr.io": {"email": "admin@domain.com", "auth": "longtexthere"}}}

如果您仍然遇到问题,您也可以下载最新版本的 minikube (0.17.1) 并运行minikube 插件配置注册表信用按照提示设置信用然后运行minikube addons启用registry-creds

现在您应该能够使用如下结构的 yaml 从 GCR 中拉取 pod:

apiVersion: v1
kind: Pod
metadata:
name: foo
namespace: default
spec:
containers:
- image: gcr.io/example-vm/helloworld:latest
name: foo

编辑:2018 年 6 月 13 日更新命令以反射(reflect) @Rambatino 的评论

关于google-cloud-platform - 无法从 Google 容器注册表将 docker 镜像拉入 Kubernetes Pod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42567849/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com