Kubernetes:无法创build存储库
我遵循Kubernete的入门指南 。 一切顺利,直到我跑了
$ gcloud docker push gcr.io/<PROJECT ID>/hello-node:v1
(哪里是我的项目ID) 由于某些原因,Kubernetes无法推送到registry。 这是我得到的:
Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded Warning: '--email' is deprecated, it will be removed soon. See usage. Login Succeeded The push refers to a repository [gcr.io/kubernetes-poc-1320/hello-node] 18465c0e312f: Preparing 5f70bf18a086: Preparing 9f7afc4ce40e: Preparing 828b3885b7b1: Preparing 5dce5ebb917f: Preparing 8befcf623ce4: Waiting 3d5a262d6929: Waiting 6eb35183d3b8: Waiting denied: Unable to create the repository, please check that you have access to do so.
任何想法,我可能做错了什么? 请注意,我已经运行。 $ gcloud init
,所以我已经login。
提前致谢!
这解决了我的情况:
简洁版本:
在https://console.cloud.google.com
的Container Engine
屏幕中按Enable billing
。
长版本:
在我的情况下,我得到了错误,因为在谷歌云平台控制台设置帐单的问题。
尽pipe我在Google云平台控制台中input了所有信用卡信息和Container Engine
屏幕,但Container Engine is getting ready. This may take a minute or more.
Container Engine is getting ready. This may take a minute or more.
,但在同一屏幕上按“ Enable billing
之前,它没有工作。 然后, gcloud docker push
命令终于起作用了。
稍后回到Container Engine
屏幕后,它显示我Container Engine is getting ready. This may take a minute or more.
了Container Engine is getting ready. This may take a minute or more.
Container Engine is getting ready. This may take a minute or more.
并再次Enable billing
button..必须是控制台中的错误。
上述解决scheme都不适合我,我终于find了一个解决scheme。 我正在使用Windows 10,并看着我的C:/用户/ / docker / config.json文件,它看起来像这样。
{ "auths": { "https://appengine.gcr.io": {}, "https://asia.gcr.io": {}, "https://b.gcr.io": {}, "https://bucket.gcr.io": {}, "https://eu.gcr.io": {}, "https://gcr.io": {}, "https://gcr.kubernetes.io": {}, "https://us.gcr.io": {} }, "credsStore": "wincred" }
删除“credsStore”:“wincred”行解决了问题!
如果您使用的是GCE实例,则需要确保它具有正确的Cloud API访问范围。 由于您无法编辑正在运行的实例的范围,因此可以使用当前的磁盘创build新的实例。
为此,请执行以下操作
- 转到您的实例页面,然后单击编辑
- 删除实例时删除启动磁盘 ,然后单击保存
- 使用以前的磁盘创build新的实例,并在存储上具有写入权限。
我得到这个相同的错误,因为我不小心使用项目名称,而不是自动生成的ID 。 PROJECT_ID
可以通过以下方式find:
$ gcloud info
以及Google Cloud信息中心: https : //console.cloud.google.com/home/dashboard
傻,我意识到,但我可以想象其他人犯同样的错误:)
确保您使用Google Cloud进行身份validation。
$ gcloud auth application-default login
仔细检查gcloud
是否指向您当前的项目。
$ gcloud config set project PROJECT_ID
如果仍有问题,请运行gcloud info
并查看Last Log File
。 注意: gcloud auth login
不会再写入应用程序默认凭据。
在https://stackoverflow.com/a/39996807/598513我回答了切换用户/帐户
gcloud auth list gcloud config set account example@gmail.com
编辑:这在几个月前为我工作。 新版本的Kubernetes可能没有这个问题,或者这个解决scheme可能无法解决它:)
好了,经过几个小时的努力之后,我终于设法把它推到grc.ioregistry中,把我的标签从一个image:version
更改为image/version
,如下所示:
gcloud docker push gcr.io/<PROJECT ID>/hello-node/v1
在阅读Kubernetes文档的另一个指南之后: https ://cloud.google.com/container-registry/docs/pushing#pushing_to_the_registry
希望这可以帮助!
对于我来说,有同样的错误,我发现我错过了一开始的“gcloud”。 那是因为之前的两个命令是从docker开始的,我只是在docker之后浏览了一下这些变化。
~/gs-spring-boot/complete$ docker -- push gcr.io/kubernetes-codelab-1xxxxx/hello-java:v1
正确:
~/gs-spring-boot/complete$ gcloud docker -- push gcr.io/kubernetes-codelab-1xxxxx/hello-java:v1
运行gcloud init
并查看是否已经login到正确的帐户。 我曾经有这个错误,因为我试图从不同的谷歌帐户推图像
当使用docker-credential-helpers将gcloud docker -- push $registry/$project_id/<image>:<tag>
凭据存储在OSX Keychain中时, gcloud docker -- push $registry/$project_id/<image>:<tag>
也会失败。
对我来说,解决scheme是将~/.docker/config.json
还原为不使用~/.docker/config.json
链安全地存储凭据
另见: https : //github.com/GoogleCloudPlatform/gcloud-common/issues/198
你用什么作为项目ID? 它不应该是“my-kubernetes-codelab”,它应该是“my-kubernetes-codelab-234231”或者任何你的编号版本。 这是我的问题。