【发布时间】:2016-10-27 09:24:55
【问题描述】:
我正在尝试在 K8s 下运行的 pod 上实现 livenessProbes。 只有非常简单的探针在工作,参见示例:
livenessProbe:
exec:
command:
- cat
- /etc/services
initialDelaySeconds: 45
timeoutSeconds: 5
我需要执行的探测是每 50 秒杀死一次 pod。
livenessProbe:
exec:
command:
mongo --port 27018 --eval "rs.status()" | grep "REMOVED" ; test $? -eq 1
initialDelaySeconds: 45
timeoutSeconds: 5
当探测未实现并且命令在 pod 内运行时,如果找到 REMOVED 字符串,则返回 1,如果未找到,则返回 0。
[root@eas-mongo-rs-3-ui81p /]# mongo --port 27018 --eval "rs.status()" | grep "已移除" ;测试$? -eq 1
问题是,如何实现Container Exec Check这样的命令。
问候
【问题讨论】:
标签: mongodb kubernetes-health-check