启动POD时获取ImagePullBackOff是AWS EKS

时间:2020-06-08 18:43:39

标签: docker kubernetes amazon-eks amazon-ecr

部署pod并尝试拉取映像时,出现以下错误。

Failed to pull image "foyer-api:latest": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/foyer-api:latest": failed to resolve reference "docker.io/library/foyer-api:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

这里是豆荚Yaml

apiVersion: v1
kind: Pod
metadata:
  name: foyer-api-test
  labels:
    app: foyer-api-test
spec:
  containers:
    - name: foyer-api
      image: foyer-api:latest
      ports:
       - containerPort: 80

1 个答案:

答案 0 :(得分:1)

要从私有注册表中提取图像,请点击here

基本上,您需要使用Docker凭证创建一个机密。例如,使用命令行

$ kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

然后在imagePullSecrets

中使用它
apiVersion: v1
kind: Pod
metadata:
  name: foyer-api-test
  labels:
    app: foyer-api-test
spec:
  containers:
  - name: foyer-api
    image: foyer-api:latest
    ports:
    - containerPort: 80
  imagePullSecrets:
  - name: regcred