how to check multiple health check path in liveness/redinessprobe in kubernetes

4/4/2020

i am running 4 services inside a kubernetes pod and all are running on same port but the health check points are different for every service. I want to add multiple path in liveness/readiness probe. Currently i am using below configuration to check the health of one service. I want to add more path. How can i do that? I have tried with binary operator("/service1/health && /service2/health && /service3/health") but that was not worked for me.

livenessProbe:
            httpGet:
              path: /service1/health 
              port: 8080
              httpHeaders:
              - name: Custom-Header
                value: iamalive
            initialDelaySeconds: 60
            failureThreshold: 5
            periodSeconds: 60
            timeoutSeconds: 120
-- neha
devops
health-check
kubernetes
linux

1 Answer

4/4/2020

You kind of can't. I mean technically you could use an exec probe and write your own logic in there, but really really don't do that. If your 4 services are independent, you should make 4 separate Deployments for them. Kubernetes does sometimes force you to rearchitect your systems but every time it does this it's pushing you towards a better system :)

-- coderanger
Source: StackOverflow