【问题标题】:ImagePullSecrets GCRImagePullSecrets GCR
【发布时间】:2018-04-30 18:51:39
【问题描述】:

我在 deployment.yaml 文件中使用 ImagePullSecrets 配置 GCR 时遇到问题。由于权限,它无法下载容器

Failed to pull image "us.gcr.io/optimal-jigsaw-185903/syncope-deb": rpc error: code = Unknown desc = Error response from daemon: denied: Permission denied for "latest" from request "/v2/optimal-jigsaw-185903/syncope-deb/manifests/latest".

我确定我做错了什么,但我遵循了本教程(以及其他类似的教程),但仍然没有运气。

https://ryaneschinger.com/blog/using-google-container-registry-gcr-with-minikube/

pod 日志同样没用:

"syncope-deb" in pod "syncope-deployment-64479cdcf5-cng57" is waiting to start: trying and failing to pull image

我的部署如下:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  # Unique key of the Deployment instance
  name: syncope-deployment
  namespace: default
spec:
  # 3 Pods should exist at all times.
  replicas: 1
  # Keep record of 2 revisions for rollback
  revisionHistoryLimit: 2
  template:
    metadata:
      labels:
        # Apply this label to pods and default
        # the Deployment label selector to this value
        app: syncope-deb
    spec:
      imagePullSecrets:
      - name: mykey
      containers:
      - name: syncope-deb
        # Run this image
        image: us.gcr.io/optimal-jigsaw-185903/syncope-deb
        ports:
        - containerPort: 9080

我在默认命名空间中有一个名为“mykey”的密钥,看起来像(编辑了安全数据):

{"https://gcr.io":{"username":"_json_key","password":"{\n  \"type\": \"service_account\",\n  \"project_id\": \"optimal-jigsaw-185903\",\n  \"private_key_id\": \"EDITED_TO_PROTECT_THE_INNOCENT\",\n  \"private_key\": \"-----BEGIN PRIVATE KEY-----\\EDITED_TO_PROTECT_THE_INNOCENT\\n-----END PRIVATE KEY-----\\n\",\n  \"client_email\": \"bobs-service@optimal-jigsaw-185903.iam.gserviceaccount.com\",\n  \"client_id\": \"109145305665697734423\",\n  \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n  \"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n  \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n  \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/bobs-service%40optimal-jigsaw-185903.iam.gserviceaccount.com\"\n}","email":"redfalconinc@gmail.com","auth":"EDITED_TO_PROTECT_THE_INNOCENT"}}

我什至为该用户加载了以下权限:

  • 编辑器云容器
  • Builder 云容器
  • 生成器编辑器服务
  • Account Actor 服务
  • 帐户管理存储
  • 管理存储对象
  • 管理员存储对象创建者
  • 存储对象查看器

任何帮助将不胜感激,因为我花了很多时间来解决看似非常简单的问题。

【问题讨论】:

  • 仍在努力解决这个问题。我确实注意到,当我向公众打开注册表时,它可以正常工作。显然是权限问题,但我配置的服务帐户具有适当的权限级别。有没有办法准确查看 minikube 尝试验证的用户?
  • 你明白了吗?

标签: kubernetes service-accounts minikube google-container-registry


【解决方案1】:

此问题很可能是由于您使用了 dockerconfigjson 类型的密钥并在其中包含有效的 dockercfg 引起的。 kubectl 命令在某些时候发生了变化,导致了这种情况。

您能否检查它标记为dockercfgdockerconfigjson 的内容,然后检查其是否有效dockerconfigjson

你提供的json是dockercfg(不是新格式)

有关格式的信息,请参阅https://github.com/kubernetes/kubernetes/issues/12626#issue-100691532

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-21
    • 2018-09-25
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-07
    • 1970-01-01
    相关资源
    最近更新 更多