Back-off restarting failed container 问题解决

简介: Back-off restarting failed container 问题解决

问题:

通过yaml文件创建pod时,执行完yaml文件,过一会就开始报错说Back-off restarting failed container

查看pod状态一致处于CrashLoopBackOff

cefe51c9094044cfb26d4dc6915f3986.png

原理:

Back-off restarting failed container的Warning事件,一般是由于通过指定的镜像启动容器后,容器内部没有常驻进程,导致容器启动成功后即退出,从而进行了持续的重启。


解决办法:

如果是通过yaml文件创建的pod,找到对应的deployment,增加命令command: ["/bin/bash", "-ce", "tail -f /dev/null"]

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: test
  name: pipeline
  labels:
    app: pipeline
spec:
  replicas: 2
  selector:
    matchLabels:
      app: pipeline
  template:
    metadata:
      labels:
        app: pipeline
    spec:
      containers:
      - name: pipeline
        image: 192.168.2.211:80/repo/pipeline:v3.0.0   # 在harbor仓库中复制一个镜像取得
        command: ["/bin/bash", "-ce", "tail -f /dev/null"]
        imagePullPolicy: Always
        ports:
        - containerPort: 8080


修改完yaml文件再次执行,就好了。

c9170da3f2ce452ab45480c737bef1f0.png

相关文章
|
Java 应用服务中间件 Maven
解决A child container failed during start报错问题
解决A child container failed during start报错问题
173 0
|
Docker 容器
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
2848 0
解决failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status co
|
Java 应用服务中间件 容器
Tomcat报错 严重: A child container failed during start
Tomcat报错 严重: A child container failed during start
194 0
|
7月前
|
Kubernetes 容器
【kubernetes】解决k8s1.28.4:"command failed" err="failed to parse kubelet flag: unknown flag: --c...
【kubernetes】解决k8s1.28.4:"command failed" err="failed to parse kubelet flag: unknown flag: --c...
1203 0
|
Java 容器
严重: A child container failed during start
严重: A child container failed during start
178 0
严重: A child container failed during start
|
Java Maven 容器
A child container failed during start
A child container failed during start
152 0
A child container failed during start
|
消息中间件
Error: unable to perform an operation on node ‘rabbit@PC-201712061807‘. Please see diagnostics infor
Error: unable to perform an operation on node ‘rabbit@PC-201712061807‘. Please see diagnostics infor
352 0
Error: unable to perform an operation on node ‘rabbit@PC-201712061807‘. Please see diagnostics infor
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
433 0
Error:svn:E155037:Previous operation has not finished; run ‘cleanup‘ if it was interrupted(完美解决)
|
NoSQL MongoDB 数据安全/隐私保护
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown
1155 0
OCI runtime exec failed: exec failed: unable to start container process: exec: "mongo": executable file not found in $PATH: unknown