Pod重启策略
2023-05-23 08:22:30 阅读次数:234
Pod,重启
重启策略
Always: 只要容器一次退出,kubelet 就会自动重启该容器
OnFailure: 当容器终止运行且退出码不为0,由kubelet自动重启容器
Never: 无论容器处于何种状态,kubelet都不会重启该容器
进入Pod指定容器指令
[root@k8smaster4 taints]# kubectl exec -it demo-pod -c tomcat-pod-java -- /bin/bash
重启策略Yaml
[root@k8smaster4 taints]# vi pod-restart.yaml
apiVersion: v1
kind: Pod
metadata:
name: demo-pod
namespace: default
labels:
environment: test
program: tomcat
spec:
restartPolicy: Always
containers:
- name: tomcat-pod-java
ports:
- containerPort: 8080
image: docker.io/xianchao/tomcat-8.5-jre8:v1
imagePullPolicy: IfNotPresent
重启策略Yaml
[root@k8smaster4 taints]# vi pod-restart.yaml
apiVersion: v1
kind: Pod
metadata:
name: demo-pod
namespace: default
labels:
environment: test
program: tomcat
spec:
restartPolicy: OnFailure
containers:
- name: tomcat-pod-java
ports:
- containerPort: 8080
image: docker.io/xianchao/tomcat-8.5-jre8:v1
imagePullPolicy: IfNotPresent
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/u_11726705/6002367,作者:You0tech,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。
上一篇:精讲响应式WebClient第4篇-文件上传与下载
下一篇:nodeAffinity