AWS ECR不提取基本身份验证凭据 [英] AWS ECR PULL no basic auth credentials

查看:15
本文介绍了AWS ECR不提取基本身份验证凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Terraform部署Azure K8s集群,该映像托管在Amazon ECR中。 从ECR拉取映像时部署失败,出现以下错误:

Failed to pull image "tooot.eu-west-1.amazonaws.com/app-t:latest": rpc error: code = Unknown desc = Error response from daemon: Get https://tooot.eu-west-1.amazonaws.com/v2/app-t/manifests/latest: no basic auth credentials

以下是我在terraform模板中的kuberentes资源

  metadata {
    name = "terraform-app-deployment-example"
    labels {
      test = "app-deployment"
    }
  }

  spec {
    replicas = 6

    selector {
      match_labels {
        test = "app-deployment"
      }
    }

    template {
      metadata {
        labels {
          test = "app-deployment"
        }
      }

      spec {
        container {
          image = "toot.eu-west-1.amazonaws.com/app-t:latest"
          name  = "app"
        }
      }
    }
  }
}`

推荐答案

基本上,您缺乏从AWS获取图像的凭据。

您需要创建一个regcred,其中包含登录凭据:

https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

之后,您需要在Terraform配置上添加regcred。我没有使用过模板,但在Deploy规范中,您会添加一个名为ImagePullSecrets的字段。

https://www.terraform.io/docs/providers/kubernetes/r/deployment.html

ImagePullSecrets说明:

Image_Pull_Secrets-(可选)ImagePullSecrets是对同一命名空间中的机密的引用的可选列表,用于提取此PodSpec使用的任何图像。如果指定,这些秘密将被传递给各个PULER实现以供其使用。例如,在docker的情况下,只接受DockerConfig类型的机密

这篇关于AWS ECR不提取基本身份验证凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆