k8s创建ubuntu容器时出现Back-off restarting failed container问题
1、问题:k8s创建ubuntu容器时出现Back-off restarting failed container,容器一直进行重启。2.原因:对于像ubuntu这样的系统级docker ,用k8s集群启动管理后,会自动关闭,解决方法就是 让其一直在运行,所以在yaml文件中增加command命令即可。3.解决:在yaml中添加如下参数:command: [ "/bin/bash", "-...
·
1、问题:k8s创建ubuntu容器时出现Back-off restarting failed container,容器一直进行重启。
2.原因:对于像ubuntu这样的系统级docker ,用k8s集群启动管理后,会自动关闭,解决方法就是 让其一直在运行,所以在yaml文件中增加command命令即可。
3.解决:在yaml中添加如下参数:
command: [ "/bin/bash", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
ubuntu.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ubuntu-deploy
spec:
replicas: 1
template:
metadata:
labels:
name: ubuntu
spec:
containers:
- name: ubuntu-tz
command: ["/bin/bash","-c","--"]
args: ["while true; do sleep 30; done;"]
securityContext:
privileged: true
image: ubuntu:16.04
重新进行部署就可以了~~~
参考:https://blog.csdn.net/weixin_30407613/article/details/98939286
更多推荐
所有评论(0)