如何从私有注册表中提取Pulumi Docker映像?

问题描述 投票:0回答:1

我已经声明了一个具有两个容器的Kubernetes部署。一个是在本地构建的,另一个则需要从私有注册表中提取。

const appImage = new docker.Image("ledgerImage", {
    imageName: 'us.gcr.io/qwil-build/ledger',
    build: "../../",
});

const ledgerDeployment = new k8s.extensions.v1beta1.Deployment("ledger", {
  spec: {
    template: {
      metadata: {
        labels: {name: "ledger"},
        name: "ledger",
      },
      spec: {
        containers: [
          {
            name: "api",
            image: appImage.imageName,
          },
          {
            name: "ssl-proxy",
            image: "us.gcr.io/qwil-build/monolith-ssl-proxy:latest",
          }
        ],

      }
    }
  }
});

[当我运行pulumi up时,它挂起-发生这种情况是由于投诉You don't have the needed permissions to perform this operation, and you may have invalid credentials。我在运行kubectl describe <name of pod>时看到此抱怨。但是,当我运行docker pull us.gcr.io/qwil-build/monolith-ssl-proxy:latest时,它执行得很好。我重新打了球gcloud auth configure-docker,但没有帮助。

[我找到了https://github.com/pulumi/pulumi-cloud/issues/112,但似乎docker.Image需要一个build arg,对我来说,这是指本地图像,而不是远程图像。

如何从专用注册表中提取图像?

编辑:

原来我有一个本地dockerfile用于构建所需的SSL代理。我用

声明了一个新的Image
const sslImage = new docker.Image("sslImage", {
  imageName: 'us.gcr.io/qwil-build/ledger-ssl-proxy',
  build: {
    context: "../../",
    dockerfile: "../../Dockerfile.proxy"
  }
});

并且正确更新了Deployment中的图像参考。但是,我仍然遇到身份验证问题。这可能是错误的错误,因为没有将正确的凭据用于部署的containers列表中索引0以外的容器?

docker docker-image pulumi
1个回答
0
投票

D'哦!看起来RemoteImage是答案:https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/docker/#RemoteImage

编辑:

我尝试过

const sslImage = new docker.RemoteImage("sslImage", {
  name: 'us.gcr.io/qwil-build/monolith-ssl-proxy:latest',
})

而且我仍然收到验证错误,所以这不是我认为的答案。

© www.soinside.com 2019 - 2024. All rights reserved.