热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Backoffrestartingfailedcontainer报错

原标题:Back-offrestartingfailedcontainer报错我的配置文件中有这样一小段

原标题:Back-off restarting failed container报错

我的配置文件中有这样一小段

apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
labels:
app: busybox
spec:
containers:
- name: busybox
image: busybox

来测试配置清单是否可用。

出现错误时:
kubectl logs busybox -p
这时候因为没有访问 是看不到日志的

kubectl describe pod busybox
看到了问题所在:

Events: Type Reason Age From
Message ---- ------ ---- ----
------- N文章来源地址15959.htmlormal Scheduled 87s default-www.yii666.comscheduler Successfully assigned default/busybox to node2 Normal Pulled
71s kubelet Successfully pulled image
“busybox” in 15.824134554s Normal Pulled 69s
kubelet Successfully pulled image “busybox” in 1.345001397s
Normal Pulled 36s kubelet Successfully
p文章来源地址15959.htmlulled image “busybox” in 15.738609779s Normal Created 36s (x3
over 71s) kubelet Created container busybox Normal
Started 36s (x3 over 71s) kubelet Started container
busybox Warning BackOff 22s (x4 over 68s) kubelet
Back-off restarting failed container Normal Pulling 11s (x4
over 87s) kubelet Pulling image文章来源站点https://www.yii666.com/ “busybox”

原来是这样。镜像启动容器后,容器内部没有常驻进程,www.yii666.com导致容器启动成功后即退出,从而进行了持续的重启。

只需要给容器加上一个常驻的进程就可以
那么就可以写成

apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
labels:
app: busybox
spec:
containers:
- name: busybox
image: busybox
command: ["/bin/sh","-ce","sleep 3600"]

在这里插入图片描述

来源于:Back-off restarting failed container报错


推荐阅读
author-avatar
pxrty_635
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有