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

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: test-file
  5. namespace: model
  6. labels:
  7. appkey: test-file
  8. spec:
  9. replicas:1
  10. selector:
  11. matchLabels:
  12. appkey: test-file
  13. template:
  14. metadata:
  15. labels:
  16. appkey: test-file
  17. spec:
  18. containers:- name: test-file
  19. image: xxx:v1
  20. command:["/bin/bash","-ce","tail -f /dev/null"]
  21. imagePullPolicy: IfNotPresent
  22. volumeMounts:- name: test-file-data
  23. mountPath:/mnt
  24. volumes:- name: test-file-data
  25. hostPath:
  26. path:/mnt

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

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

还没有评论