0


【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”]

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

本文转载自: https://blog.csdn.net/u012856866/article/details/138701701
版权归原作者 酒酿小圆子~ 所有, 如有侵权,请联系我们删除。

“【K8S】pod无限重启,报错Back-off restarting failed container”的评论:

还没有评论