title: OpenFaaS : Receiving Timeout errors during health check of function Pod
body: <p><strong>Issue:</strong></p>
  <p>We have added health check configuration to our function. However pod becomes Unhealthy due to timeout error in liveness and readiness checks and consequently getting restarted.
  <strong>However if I hit same health check url using CURL or browser it returns correct response.</strong></p>
  <p>Health check <a href="https://docs.openfaas.com/reference/workloads/#custom-http-health-check" rel="nofollow noreferrer">configuration reference</a>.</p>
  <p>We are using <strong>Kubernetes HPAv2</strong> for auto-scaling (<a href="https://docs.openfaas.com/tutorials/kubernetes-hpa/" rel="nofollow noreferrer">Reference</a>).</p>
  <p><strong>test-function.yml</strong></p>
  <pre><code>  test-function:
      lang: quarkus-java-with-fonts
      handler: ./test-function
      image: repo.azurecr.io/test-function:0.1
      labels:
        agentpool: openfaas
        com.openfaas.scale.min: &quot;2&quot;
        com.openfaas.scale.max: &quot;10&quot;
        com.openfaas.scale.factor: 0
      annotations:
       com.openfaas.health.http.path: &quot;/health&quot;
       com.openfaas.health.http.initialDelay: &quot;30s&quot;
      environment:
          secret_name: environment-variables
      secrets:
          - environment-variables 
      constraints:
          - agentpool=openfaas
      limits:
        cpu: 1500m
        memory: 1Gi
      requests:
        cpu: 500m
        memory: 500Mi
  </code></pre>
  <p><strong>Error Trace :</strong></p>
  <pre><code>Liveness probe failed: Get &quot;http://XX.XXX.XX.XX:8080/health&quot;: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
  Readiness probe failed: Get &quot;http://XX.XXX.XX.XX:8080/health&quot;: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
  </code></pre>
  <p>Any idea what could be wrong.</p>