【K8S】pod无限重启,报错Back-off restarting failed container

1. 问题

pod启动后一直重启,并报Back-off restarting failed container。

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

2. 解决方案

**解决方法:**找到对应的deployment,加上如下语句: command: ["/bin/bash", "-ce", "tail -f /dev/null"]

python 复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-file
  namespace: model
  labels:
    appkey: test-file
spec:
  replicas: 1
  selector:
    matchLabels:
      appkey: test-file
  template:
    metadata:
      labels:
        appkey: test-file
    spec:
      containers:
        - name: test-file
          image: xxx:v1
          command: ["/bin/bash", "-ce", "tail -f /dev/null"]
          imagePullPolicy: IfNotPresent
          volumeMounts:
          - name: test-file-data
            mountPath: /mnt
      volumes:
        - name: test-file-data
          hostPath: 
            path: /mnt
相关推荐
匀泪7 小时前
云原生(LVS NAT模式集群实验)
服务器·云原生·lvs
70asunflower8 小时前
用Docker创建不同的容器类型
运维·docker·容器
CodeGolang8 小时前
Docker容器化部署Zabbix监控系统完整指南
docker·容器·zabbix
DolitD8 小时前
云流技术深度剖析:国内云渲染主流技术与开源和海外厂商技术实测对比
功能测试·云原生·开源·云计算·实时云渲染
ghostwritten10 小时前
春节前夕,运维的「年关」:用 Kubeowler 给集群做一次「年终体检」
运维·云原生·kubernetes
[shenhonglei]19 小时前
灰度发布功能需求说明书
kubernetes
lpruoyu19 小时前
【Docker进阶-03】存储原理
docker·容器
文静小土豆20 小时前
Docker 与 containerd 代理配置详解:镜像拉取速度慢的终极解决方案
运维·docker·容器
JY.yuyu1 天前
Docker常用命令——数据卷管理 / 端口映射 / 容器互联
运维·docker·容器
lpruoyu1 天前
【Docker进阶-06】docker-compose & docker swarm
运维·docker·容器