如果我尝试使用 Azure 容器注册表中最新版本的镜像创建 Pod,则会收到“ImagePullBackOff”错误。如果我明确指定镜像版本,则 Pod 创建成功。
我创建了一个新的 Image Pull Secret,并且可以确认 Kubernetes 正在从 ACR 中拉取镜像,因为在设置版本时 Pod 成功启动。当我将镜像名称设置为 ACR_ImageName:latest 时(或者省略 :latest 时,或者将 imagePullPolicy 设置为“Always”时,pod 无法创建并报告以下错误:请注意,我已替换了 acr 名称和镜像姓名
Warning Failed 27m (x3 over 28m) kubelet, aks-agentpool-15809833-vmss000007
Failed to pull image "acrPath/imageName": [rpc error: code = Unknown desc = Error response from daemon: manifest for acrPath/imageName:latest not found: manifest unknown: manifest unknown, rpc error: code = Unknown desc = Error response from daemon: manifest for acrPath/imageName:latest not found: manifest unknown: manifest unknown, rpc error: code = Unknown desc = Error response from daemon: Get https://acrPath/imageName/manifests/latest: unauthorized: authentication required]
这不起作用
apiVersion: v1
kind: Pod
metadata:
name: k8spocfrontend
labels:
app: k8spocfrontend
type: frontend
spec:
containers:
- name: k8spocfrontend
image: dteuwhorizonacrhorizonmain.azurecr.io/k8spocfront:latest
imagePullPolicy: "Always"
imagePullSecrets:
- name: acr-auth-poc
这有效
apiVersion: v1
kind: Pod
metadata:
name: k8spocfrontend
labels:
app: k8spocfrontend
type: frontend
spec:
containers:
- name: k8spocfrontend
image: dteuwhorizonacrhorizonmain.azurecr.io/k8spocfront:2617
imagePullPolicy: "Always"
imagePullSecrets:
- name: acr-auth-poc
正如您从下面的 pod 中看到的,pod 是在设置版本标记时创建的。
k8spocfront-5dbf7544f8-ccnxj | 2/2 | Running | 0 | 33m
最佳答案
您似乎没有带有最新标签的图片。基本上我们将最新标签覆盖到最新版本的图像。
关于azure - 除非我指定特定的标签版本,否则为什么我会得到 ImagePullBackOff?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57658852/