gpt4 book ai didi

docker - 在Pod中获取 “ErrImageNeverPull”

转载 作者:行者123 更新时间:2023-12-04 20:27:19 24 4
gpt4 key购买 nike

我正在使用minikube测试部署,并正在通过this链接

我要部署的 list 文件就像

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: webapp
spec:
replicas: 1
template:
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
imagePullPolicy: Never # <-- here we go!
image: sams
ports:
- containerPort: 80

然后当我尝试执行以下命令时输出
user@usesr:~/Downloads$ kubectl create -f mydeployment.yaml --validate=false

deployment "webapp" created

user@user:~/Downloads$ kubectl get deployments

NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
---- -------- ------- ---------- --------- ----
webapp 1 1 1 0 9s

user@user:~/Downloads$ kubectl get pods

NAME READY STATUS RESTARTS AGE
---- -------- ------- ---------- --------- ----
webapp-5bf5bd94d-2xgs8 0/1 ErrImageNeverPull 0 21s

我什至试图通过从 Docker-Hub中删除行 imagePullPolicy: Neverdeployment.yml中提取图像,但是得到了同样的错误。谁能在这里帮助我找出问题所在和出了什么问题

根据评论更新了问题
kubectl describe pod $POD_NAME
Name: webapp-5bf5bd94d-2xgs8
Namespace: default
Node: minikube/10.0.2.15
Start Time: Fri, 31 May 2019 14:25:41 +0530
Labels: app=webapp
pod-template-hash=5bf5bd94d
Annotations: <none>
Status: Pending
IP: 172.17.0.4
Controlled By: ReplicaSet/webapp-5bf5bd94d
Containers:
webapp:
Container ID:
Image: sams
Image ID:
Port: 80/TCP
State: Waiting
Reason: ErrImageNeverPull
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-wf82w (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-wf82w:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-wf82w
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 18m default-scheduler Successfully assigned default/webapp-5bf5bd94d-2xgs8 to minikube
Warning ErrImageNeverPull 8m (x50 over 18m) kubelet, minikube Container image "sams" is not present with pull policy of Never
Warning Failed 3m (x73 over 18m) kubelet, minikube Error: ErrImageNeverPull

docker images:

REPOSITORY TAG IMAGE ID CREATED SIZE
---------- --- -------- ------- ----
<none> <none> 723ce2b3d962 3 hours ago 1.91GB
bean_ben501/sams latest c7c4a04713f4 4 hours ago 278MB
sams latest c7c4a04713f4 4 hours ago 278MB
sams v1 c7c4a04713f4 4 hours ago 278MB
<none> <none> b222da630bc3 4 hours ago 1.91GB
mcr.microsoft.com/dotnet/core/sdk 2.2-stretch e4747ec2aaff 9 days ago 1.74GB
mcr.microsoft.com/dotnet/core/aspnet 2.2-stretch-slim f6d51449c477 9 days ago 260MB

最佳答案

When using a single VM for Kubernetes, it’s useful to reuse Minikube’s built-in Docker daemon. Reusing the built-in daemon means you don’t have to build a Docker registry on your host machine and push the image into it. Instead, you can build inside the same Docker daemon as Minikube, which speeds up local experiments.



以下命令神奇
eval $(minikube docker-env)
对于 imagePullPolicy: Never,图像必须位于minikube节点上。

This answer provide details

local-images-in minikube docker environment

关于docker - 在Pod中获取 “ErrImageNeverPull”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56392041/

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