我创建了一个 mock.Dockerfile,它只包含一行。
FROM eu.gcr.io/some-org/mock-service:0.2.0
使用该配置和对它的构建部分的引用,skaffold 使用私有 GCR 注册表构建该 dockerfile。但是,如果我删除该 Dockerfile,skaffold 不会构建它,并且在启动 skaffold 时它只会加载该build
部分中引用的图像(公共图像,如 postgres 也可以)。所以在本地 kubernetes 配置中,比如 minikube,这会导致
ImagePullBackOff
Failed to pull image "eu.gcr.io/some-org/mock-service:0.2.0": rpc error: code = Unknown desc = Error response from daemon: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials
所以基本上当我创建一个单行 Dockerfile 并包含它时,skaffold 会构建该图像并将其加载到 minikube 中。现在可以更改 minikube 配置,以便对 GCR 的请求成功,但目标是开发人员不必更改他们的 minikube 配置...
有没有其他方法可以将该图像加载到 Minikube 中,而无需更改配置且无需该单行 Dockerfile?
skaffold.yaml:
apiVersion: skaffold/v2beta8
kind: Config
metadata:
name: some-service
build:
artifacts:
- image: eu.gcr.io/some-org/some-service
docker:
dockerfile: Dockerfile
- image: eu.gcr.io/some-org/mock-service
docker:
dockerfile: mock.Dockerfile
local: { }
profiles:
- name: mock
activation:
- kubeContext: (minikube|kind-.*|k3d-(.*))
deploy:
helm:
releases:
- name: postgres
chartPath: test/postgres
- name: mock-service
chartPath: test/mock-service
- name: skaffold-some-service
chartPath: helm/some-service
artifactOverrides:
image: eu.gcr.io/some-org/some-service
setValues:
serviceAccount.create: true