github.com/projectcontour/contour@v1.28.2/site/content/docs/v1.10.0/config/health-checks.md (about)

     1  # Upstream Health Checks
     2  
     3  ## HTTP Proxy Health Checking
     4  
     5  Active health checking can be configured on a per route basis.
     6  Contour supports HTTP health checking and can be configured with various settings to tune the behavior.
     7  
     8  During HTTP health checking Envoy will send an HTTP request to the upstream Endpoints.
     9  It expects a 200 response if the host is healthy.
    10  The upstream host can return 503 if it wants to immediately notify Envoy to no longer forward traffic to it.
    11  It is important to note that these are health checks which Envoy implements and are separate from any other system such as those that exist in Kubernetes.
    12  
    13  ```yaml
    14  # httpproxy-health-checks.yaml
    15  apiVersion: projectcontour.io/v1
    16  kind: HTTPProxy
    17  metadata:
    18    name: health-check
    19    namespace: default
    20  spec:
    21    virtualhost:
    22      fqdn: health.bar.com
    23    routes:
    24    - conditions:
    25      - prefix: /
    26      healthCheckPolicy:
    27        path: /healthy
    28        intervalSeconds: 5
    29        timeoutSeconds: 2
    30        unhealthyThresholdCount: 3
    31        healthyThresholdCount: 5
    32      services:
    33        - name: s1-health
    34          port: 80
    35        - name: s2-health
    36          port: 80
    37  ```
    38  
    39  Health check configuration parameters:
    40  
    41  - `path`: HTTP endpoint used to perform health checks on upstream service (e.g. `/healthz`). It expects a 200 response if the host is healthy. The upstream host can return 503 if it wants to immediately notify downstream hosts to no longer forward traffic to it.
    42  - `host`: The value of the host header in the HTTP health check request. If left empty (default value), the name "contour-envoy-healthcheck" will be used.
    43  - `intervalSeconds`: The interval (seconds) between health checks. Defaults to 5 seconds if not set.
    44  - `timeoutSeconds`: The time to wait (seconds) for a health check response. If the timeout is reached the health check attempt will be considered a failure. Defaults to 2 seconds if not set.
    45  - `unhealthyThresholdCount`: The number of unhealthy health checks required before a host is marked unhealthy. Note that for http health checking if a host responds with 503 this threshold is ignored and the host is considered unhealthy immediately. Defaults to 3 if not defined.
    46  - `healthyThresholdCount`: The number of healthy health checks required before a host is marked healthy. Note that during startup, only a single successful health check is required to mark a host healthy.
    47  
    48  ## TCP Proxy Health Checking
    49  
    50  Contour also supports TCP health checking and can be configured with various settings to tune the behavior.
    51  
    52  During TCP health checking Envoy will send a connect-only health check to the upstream Endpoints.
    53  It is important to note that these are health checks which Envoy implements and are separate from any
    54  other system such as those that exist in Kubernetes.
    55  
    56  ```yaml
    57  apiVersion: projectcontour.io/v1
    58  kind: HTTPProxy
    59  metadata:
    60    name: tcp-health-check
    61    namespace: default
    62  spec:
    63    virtualhost:
    64      fqdn: health.bar.com
    65    tcpproxy:
    66      healthCheckPolicy:
    67        intervalSeconds: 5
    68        timeoutSeconds: 2
    69        unhealthyThresholdCount: 3
    70        healthyThresholdCount: 5
    71      services:
    72        - name: s1-health
    73          port: 80
    74        - name: s2-health
    75          port: 80
    76  ```
    77  
    78  TCP Health check policy configuration parameters:
    79  
    80  - `intervalSeconds`: The interval (seconds) between health checks. Defaults to 5 seconds if not set.
    81  - `timeoutSeconds`: The time to wait (seconds) for a health check response. If the timeout is reached the health check attempt will be considered a failure. Defaults to 2 seconds if not set.
    82  - `unhealthyThresholdCount`: The number of unhealthy health checks required before a host is marked unhealthy. Note that for http health checking if a host responds with 503 this threshold is ignored and the host is considered unhealthy immediately. Defaults to 3 if not defined.
    83  - `healthyThresholdCount`: The number of healthy health checks required before a host is marked healthy. Note that during startup, only a single successful health check is required to mark a host healthy.