gpt4 book ai didi

docker - Ballerina:构建镜像并通过 k8s 插件推送到 gcr.io

转载 作者:行者123 更新时间:2023-12-02 12:06:52 25 4
gpt4 key购买 nike

我使用的是简单的 ballerina使用 ballerinax/kubernetes 构建我的程序(简单的 hello world)的代码注释。该服务正在成功编译,并可通过本地主机的特定绑定(bind)端口访问。

在配置 kubernetes 部署时,我指定了镜像构建和推送标志:

@kubernetes:Deployment {
replicas: 2,
name: "hello-deployment",
image: "gcr.io/<gct-project-name>/hello-ballerina:0.0.2",
imagePullPolicy: "always",
buildImage: true,
push: true
}

构建源代码时:
ballerina build hello.bal

这就是我得到的:
Compiling source
hello.bal

Generating executable
./target/hello.balx
@docker - complete 3/3

Run following command to start docker container:
docker run -d -p 9090:9090 gcr.io/<gcr-project-name>/hello-ballerina:0.0.2

@kubernetes:Service - complete 1/1
@kubernetes:Deployment - complete 1/1
error [k8s plugin]: Unable to push docker image: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

请注意,当在我的本地机器上通过 docker 手动推送它时,它可以找到并推送新图像。

我错过了什么?有没有办法通过 kubernetes 告诉芭蕾舞 Actor 有关 docker 注册表凭据的信息?包裹?

最佳答案

Ballerina 还不支持 gcloud docker registry,但它支持 dockerhub。
请引用 sample6了解更多信息。

基本上,您可以将 docker 注册表用户名和密码导出为环境变量。

请在 https://github.com/ballerinax/kubernetes/issues 创建问题跟踪这个。

关于docker - Ballerina:构建镜像并通过 k8s 插件推送到 gcr.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51464404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com