大网数据广告活动
服务器运维问答

Kubernetes CrashLoopBackOff after pod create pulling image from Docker Hub

· 52CE 我爱测

On a Digital Ocean Kubernetes Cluster I am trying to create a pod using a Docker image pulled from Docker Hub but it keeps failing with CrashLoopBackOff and restarting. The image is a Rails app in a docker container and is quite …

问题原文

原帖链接 · markhorrocks · CC BY-SA 4.0

On a Digital Ocean Kubernetes Cluster I am trying to create a pod using a Docker image pulled from Docker Hub but it keeps failing with CrashLoopBackOff and restarting. The image is a Rails app in a docker container and is quite large. I suspect that Kubernetes is restarting the pod before the image can load.

Here are the errors:

kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE exactpos-deployment-864c768bff-zr86t 0/1 CrashLoopBackOff 10 27m 10.244.66.4 sleepy-nobel-3v8a nginx-deployment-7d69d57649-97w92 1/1 Running 0 40m 10.244.66.7 sleepy-nobel-3v8a

Events: Type Reason Age From Message
---- ------ ---- ---- ------- Normal Scheduled 27m default-scheduler Successfully assigned default/exactpos-deployment-864c768bff-zr86t to sleepy-nobel-3v8a

Normal Pulled 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Successfully pulled image "index.docker.io/markhorrocks/exactpos_web:prod"

Normal Created 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Created container

Normal Started 26m (x4 over 27m) kubelet, sleepy-nobel-3v8a Started container

Normal Pulling 26m (x5 over 27m) kubelet, sleepy-nobel-3v8a pulling image "index.docker.io/markhorrocks/exactpos_web:prod"

Warning BackOff 2m (x117 over 27m) kubelet, sleepy-nobel-3v8a Back-off restarting failed container

Here is my yaml file

apiVersion: apps/v1 
kind: Deployment 
metadata: 
  name: exactpos-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: exactpos-deployment
  template:
    metadata:
      labels:
        app: exactpos-deployment
    spec:
      containers:
        - name: exactpos
          image: index.docker.io/markhorrocks/exactpos_web:prod
          imagePullPolicy: Always
          command: [ "echo", "SUCCESS" ]
      imagePullSecrets:
         - name: dockerhub-cred

已采纳解答

原帖链接 · Arush · CC BY-SA 4.0

i sat on this kind of problem for about 18 hours or more.

the solution was simple, as usual. simply check your /etc/resolv.conf in your workers have proper DNS resolution. like this:

vi /etc/resolv.conf

nameserver 8.8.8.8 (new line) nameserver 8.8.4.4

restart the bad pods by deleting them.

this is 4 year's old question. but i never saw my answer on the internet anywhere.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-12-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。