我有这个kubernetes yaml文件
apiVersion: v1
kind: Service
metadata:
name: incremental-api-load-balancer
spec:
selector:
app: incremental-api
tier: api
ports:
- protocol: "TCP"
port: 80
targetPort: 80
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
name: incremental-external-api-service
spec:
selector:
app: incremental-external-api
tier: sidecar
ports:
- protocol: "TCP"
port: 80
targetPort: 80
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: incremental-api-deployment
spec:
selector:
matchLabels:
app: incremental-api
tier: api
track: stable
replicas: 3
template:
metadata:
labels:
app: incremental-api
tier: api
track: stable
spec:
containers:
- name: incremental-flask-app
image: incremental-flask
imagePullPolicy: Never
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: incremental-external-api-deployment
spec:
selector:
matchLabels:
app: incremental-external-api
tier: sidecar
track: stable
replicas: 1
template:
metadata:
labels:
app: incremental-external-api
tier: sidecar
track: stable
spec:
containers:
- name: incremental-external-api
image: incremental-external-api
imagePullPolicy: Never
当我做
docker images ls
我知道了
REPOSITORY TAG IMAGE ID CREATED SIZE
incremental-flask latest 8bbc4c45efdf 2 minutes ago 1.21GB
incremental-external-api latest 532203259006 3 minutes ago 1.2GB
从这个答案看 - Docker for Mac(Edge) - Kubernetes - reference local image
我应该拉动当地的形象。
但是,当我跑步时,我得到了这个
kubectl get pods
incremental-api-deployment-98b5d7c95-bmqbf 0/1 ErrImageNeverPull 0 1m
incremental-api-deployment-98b5d7c95-tktqv 0/1 ErrImageNeverPull 0 1m
incremental-api-deployment-98b5d7c95-xcwk2 0/1 ErrImageNeverPull 0 1m
incremental-external-api-service-deployment-b9dddff77-6z4p9 0/1 ErrImageNeverPull 0 1m
我正在使用Docker Desktop运行本地群集,我想拉取本地图像。
为什么会发生这种错误?
只需使用特定的标签版本而不是“最新”(检查配置最佳实践here)。