Kubernetes:无法创建存储库

时间:2016-05-24 02:55:30

标签: docker kubernetes google-cloud-platform

我跟随Kubernete's getting started guide。一切顺利,直到我跑了

$ gcloud docker push gcr.io/<PROJECT ID>/hello-node:v1

(在哪里,我的项目ID)。出于某种原因,Kubernetes无法进入注册表。这就是我得到的:

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,所以我已登录。

提前致谢!

11 个答案:

答案 0 :(得分:8)

这解决了我的情况:

简短版:

Enable billing的{​​{1}}屏幕中按Container Engine

长版:

在我的情况下,由于在Google云平台控制台中设置结算的问题,我收到了错误。

虽然我输入了我的所有信用卡信息,并且我在谷歌云平台控制台https://console.cloud.google.com屏幕上显示了Container Engine,但在我按下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.再次..但必须是控制台中的错误。

答案 1 :(得分:4)

上述解决方案都不适合我,我终于找到了解决方案。我使用的是Windows 10并查看了我的C:/ Users //。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"
}

删除&#34; credsStore&#34;:&#34; wincred&#34; 行解决了问题!

答案 2 :(得分:1)

编辑:几个月前,这对我有用。新版本的Kubernetes可能没有这个问题,或者这个解决方案可能无法解决它:)

好的,经过几个小时的努力,我终于设法通过将我的标记从image:version表示法更改为image/version来将其推送到grc.io注册表中,如下所示:

gcloud docker push gcr.io/<PROJECT ID>/hello-node/v1

阅读了Kubernetes&#39;文档:https://cloud.google.com/container-registry/docs/pushing#pushing_to_the_registry

希望这有帮助!

答案 3 :(得分:1)

如果您正在使用GCE实例,则需要确保它具有正确的Cloud API访问范围。 由于您无法在运行的实例上编辑范围,因此可以使用当前磁盘创建新实例。

为此,请执行以下操作

  • 转到您的实例页面,然后点击修改
  • 取消选中删除实例时删除启动磁盘,然后点击保存
  • 使用以前的磁盘创建新实例,并在存储上具有写入权限。

答案 4 :(得分:1)

我收到同样的错误,因为我不小心使用了项目 name 而不是自动生成的 id PROJECT_ID可以通过以下网址找到:

$ gcloud info

以及Google Cloud信息中心:https://console.cloud.google.com/home/dashboard

愚蠢,我意识到,但我可以想象其他人犯了同样的错误:)

答案 5 :(得分:1)

确保您使用Google Cloud进行身份验证。

$ gcloud auth application-default login

仔细检查gcloud是否指向您当前的项目。

$ gcloud config set project PROJECT_ID

如果仍有问题,请运行gcloud info并查看Last Log File。注意:gcloud auth login不再写入应用程序默认凭据。

答案 6 :(得分:1)

https://stackoverflow.com/a/39996807/598513我回答了切换用户/帐户

gcloud auth list
gcloud config set account example@gmail.com

答案 7 :(得分:1)

对我来说,遇到同样的错误,我发现我错过了&#34; gcloud&#34;在一开始的时候。那是因为之前的两个命令是以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

答案 8 :(得分:0)

运行gcloud init,看看您是否已登录到正确的帐户。我曾经有过这个错误,因为我试图从不同的谷歌帐户推送图像

答案 9 :(得分:0)

使用docker-credential-helpers在OSX Keychain中存储泊坞窗凭据时,gcloud docker -- push $registry/$project_id/<image>:<tag>也会失败。

我的解决方案是将~/.docker/config.json还原为不使用钥匙串安全地存储凭据

另请参阅:https://github.com/GoogleCloudPlatform/gcloud-common/issues/198

答案 10 :(得分:-1)

您使用什么作为项目ID?它不应该是&#34; my-kubernetes-codelab&#34;,它应该是&#34; my-kubernetes-codelab-234231&#34;或者你编号的版本。这是我的问题。