We deploy a Haproxy Pod in kubernetes cluster, and we config health check below:
"livenessProbe": {
"exec": {
"command": [
"/bin/bash",
"-c",
"test `ps -eo stat,command | grep -v grep | grep haproxy | awk '{print $1}' | grep ^T | wc -l` == 0"
]
},
"initialDelaySeconds": 15,
"periodSeconds": 3,
"failureThreshold": 3,
"timeoutSeconds": 3
}
In this way, the exec command rely on docker service and does not really check the status of haproxy service. As I know, haproxy does not open an internal port for health check in such k8s pod type.