9.1健康检查
Last updated
Last updated
$ pwd
/
$ echo $?
0
$ cd /hello
bash: cd: /hello: No such file or directory
$ echo $?
1livenessProbe:
exec:
command:
- /bin/sh
- -c
- ps -ef|grep java|grep -v grep
initialDelaySeconds:10 # 容器启动10s之后再执行
periodSecond:10 # 健康检查的间隔,每10s检查一次
failureThreshold:2 # 允许失败2次,失败次数超过2次,pod将重启
successThreshold:1 # 从错误到正确,正确执行1次,却认为pod正常
timeoutSeconds:5 # 命令的最长等待时间,执行命令时间超过5s,任务本次健康检查失败livenessProbe:
httpGet:
path: /examples/index.html
port: 8080
scheme: HTTP
initialDelaySeconds:10 # 容器启动10s之后再执行
periodSecond:10 # 健康检查的间隔,每10s检查一次
failureThreshold:2 # 允许失败2次,失败次数超过2次,pod将重启
successThreshold:1 # 从错误到正确,正确执行1次,却认为pod正常
timeoutSeconds:5 # 命令的最长等待时间,执行命令时间超过5s,任务本次健康检查失败livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds:10 # 容器启动10s之后再执行
periodSecond:10 # 健康检查的间隔,每10s检查一次
failureThreshold:2 # 允许失败2次,失败次数超过2次,pod将重启
successThreshold:1 # 从错误到正确,正确执行1次,却认为pod正常
timeoutSeconds:5 # 命令的最长等待时间,执行命令时间超过5s,任务本次健康检查失败netstat -ntlp