Skip to content

CLI & Ping

Checking the Health of your Traefik Instances

CLI

The CLI can be used to make a request to the /ping endpoint to check the health of Traefik. Its exit status is 0 if Traefik is healthy and 1 otherwise.

This can be used with HEALTHCHECK instruction or any other health check orchestration mechanism.

Usage

traefik healthcheck [command] [flags] [arguments]

Example:

$ traefik healthcheck
OK: http://:8082/ping

Ping

The /ping health-check URL is enabled with the command-line --ping or config file option [ping].

The entryPoint where the /ping is active can be customized with the entryPoint option, whose default value is traefik (port 8080).

Path Method Description
/ping GET, HEAD An endpoint to check for Traefik process liveness. Return a code 200 with the content: OK

Configuration Example

To enable the API handler:

ping: {}
[ping]
--ping=true

Configuration Options

Field Description Default Required
ping.entryPoint Enables /ping on a dedicated EntryPoint. traefik No
ping.manualRouting Disables the default internal router in order to allow one to create a custom router for the ping@internal service when set to true. false No
ping.terminatingStatusCode Defines the status code for the ping handler during a graceful shut down. See more information here 503 No

terminatingStatusCode

During the period in which Traefik is gracefully shutting down, the ping handler returns a 503 status code by default.
If Traefik is behind, for example a load-balancer doing health checks (such as the Kubernetes LivenessProbe), another code might be expected as the signal for graceful termination.
In that case, the terminatingStatusCode can be used to set the code returned by the ping handler during termination.

ping:
  terminatingStatusCode: 204
[ping]
  terminatingStatusCode = 204
--ping.terminatingStatusCode=204