根据官方文档,我应该能够使用一些漂亮的kustomization
语法轻松地覆盖我的 docker 图像的标签和名称。我试图重现这一点。
在我的deployment.yaml
我有以下内容:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
service: my-app
name: my-app
spec:
strategy:
type: Recreate
template:
metadata:
labels:
service: my-app
spec:
imagePullSecrets:
- name: my-docker-secret
containers:
- name: my-app
image: the-my-app
imagePullPolicy: Always
ports:
- containerPort: 1234
restartPolicy: Always
在我的kustomization.yaml
我有以下内容:
bases:
- ../base
resources:
- deployment.yaml
namespace: my-namespace
images:
- name: the-my-app
- newName: my.docker.registry.com/my-project/my-app
newTag: test
但是,当我这样做时:
kubectl apply -k my-kustomization-dir
并等待部署启动,然后再做
kubectl describe pod/my-app-xxxxxxxxx-xxxxx
事件如下所示:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Successfully assigned my-namespace/my-app-xxxxxxxxxx-xxxxx to default-pool-xxxxxxxxxx-xxxxx
Normal Pulling 2s kubelet, default-pool-xxxxxxxxxx-xxxxx pulling image "the-my-app"
Warning Failed 0s kubelet, default-pool-xxxxxxxxxx-xxxxx Failed to pull image "the-my-app": rpc error: code = Unknown desc = Error response from daemon: pull access denied for the-my-app, repository does not exist or may require 'docker login'
Warning Failed 0s kubelet, default-pool-xxxxxxxxxx-xxxxx Error: ErrImagePull
Normal BackOff 0s kubelet, default-pool-xxxxxxxxxx-xxxxx Back-off pulling image "the-my-app"
Warning Failed 0s kubelet, default-pool-xxxxxxxxxx-xxxxx Error: ImagePullBackOff
表明这没有按预期工作(它试图提取 中指定的原始名称deployment.yaml
)。
所以我的问题是,我在这里做错了什么?