Search code examples
kubernetesprobekubernetes-health-check

Providing multiple health check URLs for kubernetes probes


I am using container Probes to check the health of the application running inside the container within kubernetes pod. For now my example pod config looks like,

"spec":{
   "containers":[
      {
        "image":"tomcat",
        "name":"tomcat",
        "livenessProbe":{
           "httpGet":{
              "port": 80
            },
            "initialDelaySeconds": 15,
            "periodSeconds": 10
        }
      }
   ]
}

In my case, I need to monitor two ports for the same container. 80 and 443. But I am unable to find a method to provide both the ports for same container in the config file. Is there an alternate way of doing this?


Solution

  • If you have curl / wget on the container you could just run a container exec healthcheck, and do something like curl localhost:80 && curl localhost:443.