ImagePull退缩:Kubernetes Mongo部署

发布于 2025-02-11 21:38:09 字数 6051 浏览 1 评论 0原文

我尝试使用连接到虚拟框的Minikube群集创建部署。但是它与下面提到的ImagePullBackoff错误一起结果(Windows PowerShell-Admin权利上传递了命令) 我以Docker作为驾驶员尝试,但结果相同。

ps c:\ windows \ system32> kubectl get pod 名称准备状态重新开始年龄 Mongo-express-98C6FF4B4-L7JMN 0/1 ImagePullBackoff 0 116m mongodb-Deployment-67DCFB9C9F-MFVXR 0/1 ImagePullBackoff 0 116m

PS C:\Windows\system32> kubectl describe pod
Name:         mongo-express-98c6ff4b4-l7jmn
Namespace:    default
Priority:     0
Node:         minikube/192.168.59.113
Start Time:   Thu, 30 Jun 2022 19:10:41 +0530
Labels:       app=mongo-express
              pod-template-hash=98c6ff4b4
Annotations:  <none>
Status:       Pending
IP:           172.17.0.4
IPs:
  IP:           172.17.0.4
Controlled By:  ReplicaSet/mongo-express-98c6ff4b4
Containers:
  mongo-express:
    Container ID:
    Image:          mongo-express
    Image ID:
    Port:           8081/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME:  <set to the key 'mongo-root-username' in secret 'mongodb-secret'>  Optional: false
      ME_CONFIG_MONGODB_ADMINPASSWORD:  <set to the key 'mongo-root-password' in secret 'mongodb-secret'>  Optional: false
      ME_CONFIG_MONGODB_SERVER:         <set to the key 'database_url' of config map 'mongodb-configmap'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lp9nk (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-lp9nk:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  60m                  default-scheduler  Successfully assigned default/mongo-express-98c6ff4b4-l7jmn to minikube
  Warning  Failed     58m (x6 over 59m)    kubelet            Error: ImagePullBackOff
  Normal   Pulling    58m (x4 over 59m)    kubelet            Pulling image "mongo-express"
  Warning  Failed     58m (x4 over 59m)    kubelet            Failed to pull image "mongo-express": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
  Warning  Failed     58m (x4 over 59m)    kubelet            Error: ErrImagePull
  Warning  Failed     29m (x2 over 36m)    kubelet            Failed to pull image "mongo-express": rpc error: code = Unknown desc = context deadline exceeded
  Normal   BackOff    19m (x141 over 59m)  kubelet            Back-off pulling image "mongo-express"


Name:         mongodb-deployment-67dcfb9c9f-mfvxr
Namespace:    default
Priority:     0
Node:         minikube/192.168.59.113
Start Time:   Thu, 30 Jun 2022 19:10:32 +0530
Labels:       app=mongodb
              pod-template-hash=67dcfb9c9f
Annotations:  <none>
Status:       Pending
IP:           172.17.0.3
IPs:
  IP:           172.17.0.3
Controlled By:  ReplicaSet/mongodb-deployment-67dcfb9c9f
Containers:
  mongodb:
    Container ID:
    Image:          mongo
    Image ID:
    Port:           27017/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:
      MONGO_INITDB_ROOT_USERNAME:  <set to the key 'mongo-root-username' in secret 'mongodb-secret'>  Optional: false
      MONGO_INITDB_ROOT_PASSWORD:  <set to the key 'mongo-root-password' in secret 'mongodb-secret'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ft77v (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-ft77v:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  60m                  default-scheduler  Successfully assigned default/mongodb-deployment-67dcfb9c9f-mfvxr to minikube
  Warning  Failed     58m (x6 over 60m)    kubelet            Error: ImagePullBackOff
  Normal   Pulling    58m (x4 over 60m)    kubelet            Pulling image "mongo"
  Warning  Failed     58m (x4 over 60m)    kubelet            Failed to pull image "mongo": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
  Warning  Failed     58m (x4 over 60m)    kubelet            Error: ErrImagePull
  Warning  Failed     34m                  kubelet            Failed to pull image "mongo": rpc error: code = Unknown desc = context deadline exceeded
  Normal   BackOff    19m (x134 over 60m)  kubelet            Back-off pulling image "mongo"

I tried creating a deployment with minikube cluster connected to virtual box.But it results with below mentioned Imagepullbackoff error(Passed commands on Windows powershell-admin rights)
I tried with docker as a driver but same result.Help me out!!

PS C:\Windows\system32>kubectl get pod
NAME READY STATUS RESTARTS AGE
mongo-express-98c6ff4b4-l7jmn 0/1 ImagePullBackOff 0 116m
mongodb-deployment-67dcfb9c9f-mfvxr 0/1 ImagePullBackOff 0 116m

PS C:\Windows\system32> kubectl describe pod
Name:         mongo-express-98c6ff4b4-l7jmn
Namespace:    default
Priority:     0
Node:         minikube/192.168.59.113
Start Time:   Thu, 30 Jun 2022 19:10:41 +0530
Labels:       app=mongo-express
              pod-template-hash=98c6ff4b4
Annotations:  <none>
Status:       Pending
IP:           172.17.0.4
IPs:
  IP:           172.17.0.4
Controlled By:  ReplicaSet/mongo-express-98c6ff4b4
Containers:
  mongo-express:
    Container ID:
    Image:          mongo-express
    Image ID:
    Port:           8081/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME:  <set to the key 'mongo-root-username' in secret 'mongodb-secret'>  Optional: false
      ME_CONFIG_MONGODB_ADMINPASSWORD:  <set to the key 'mongo-root-password' in secret 'mongodb-secret'>  Optional: false
      ME_CONFIG_MONGODB_SERVER:         <set to the key 'database_url' of config map 'mongodb-configmap'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lp9nk (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-lp9nk:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  60m                  default-scheduler  Successfully assigned default/mongo-express-98c6ff4b4-l7jmn to minikube
  Warning  Failed     58m (x6 over 59m)    kubelet            Error: ImagePullBackOff
  Normal   Pulling    58m (x4 over 59m)    kubelet            Pulling image "mongo-express"
  Warning  Failed     58m (x4 over 59m)    kubelet            Failed to pull image "mongo-express": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
  Warning  Failed     58m (x4 over 59m)    kubelet            Error: ErrImagePull
  Warning  Failed     29m (x2 over 36m)    kubelet            Failed to pull image "mongo-express": rpc error: code = Unknown desc = context deadline exceeded
  Normal   BackOff    19m (x141 over 59m)  kubelet            Back-off pulling image "mongo-express"


Name:         mongodb-deployment-67dcfb9c9f-mfvxr
Namespace:    default
Priority:     0
Node:         minikube/192.168.59.113
Start Time:   Thu, 30 Jun 2022 19:10:32 +0530
Labels:       app=mongodb
              pod-template-hash=67dcfb9c9f
Annotations:  <none>
Status:       Pending
IP:           172.17.0.3
IPs:
  IP:           172.17.0.3
Controlled By:  ReplicaSet/mongodb-deployment-67dcfb9c9f
Containers:
  mongodb:
    Container ID:
    Image:          mongo
    Image ID:
    Port:           27017/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:
      MONGO_INITDB_ROOT_USERNAME:  <set to the key 'mongo-root-username' in secret 'mongodb-secret'>  Optional: false
      MONGO_INITDB_ROOT_PASSWORD:  <set to the key 'mongo-root-password' in secret 'mongodb-secret'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ft77v (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-ft77v:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  60m                  default-scheduler  Successfully assigned default/mongodb-deployment-67dcfb9c9f-mfvxr to minikube
  Warning  Failed     58m (x6 over 60m)    kubelet            Error: ImagePullBackOff
  Normal   Pulling    58m (x4 over 60m)    kubelet            Pulling image "mongo"
  Warning  Failed     58m (x4 over 60m)    kubelet            Failed to pull image "mongo": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host
  Warning  Failed     58m (x4 over 60m)    kubelet            Error: ErrImagePull
  Warning  Failed     34m                  kubelet            Failed to pull image "mongo": rpc error: code = Unknown desc = context deadline exceeded
  Normal   BackOff    19m (x134 over 60m)  kubelet            Back-off pulling image "mongo"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柒七 2025-02-18 21:38:09

尝试先拉图像,然后创建部署。

minikube image pull mongo

upd :有时甚至图像拉无济于事。 Minikube开发人员说,您可以卷曲检查是否可以连接到回购。也可能存在ISP问题。临时将我的ISP更改为移动数据,并且安装所需的POD对我有用。

Try to pull image first, then create deployment.

minikube image pull mongo

UPD: Sometimes even image pull doesn't help. minikube developers said that you can curl to check whether you can connect to repo or not. There also may be ISP issues. Temporary changing my ISP to mobile data and installing needed pods worked for me.

一个人的旅程 2025-02-18 21:38:09

错误上下文截止日期超过意味着Minikube无法使用预期的时间范围提取Mongo-Express图像。

您可以通过在创建部署之前直接使用以下命令来直接拉出图像来解决此问题。

minikube image pull mongo-express

The error context deadline exceeded means that minikube was unable to pull mongo-express image with the expected time frame.

You can fix this by directly pulling your image using the below command before creating your deployment.

minikube image pull mongo-express
穿越时光隧道 2025-02-18 21:38:09

我从Elver答案中获得了灵感,此Github讨论

确实,这是因为您要绘制的图像太大,并且默认的时间设置要缩短图像。因此,您应该将此图像首先通过以下示例命令将其拉到本地,然后重新创建您的部署:

Minikube SSH Docker Pull Mongo

I got inspiration from elver answer and this github discussion .

Indeed, it is because the image you want to pull is too large and the default time setting to pull an image is shorter. Thus, you should pull this image to your local first by below example command then recreate your deployment:

minikube ssh docker pull mongo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文