* For caddy v1 in our org This RP changes all imports for caddyserver/caddy to coredns/caddy. This is the v1 code of caddy. For the coredns/caddy repo the following changes have been made: * anything not needed by us is deleted * all `telemetry` stuff is deleted * all its import paths are also changed to point to coredns/caddy * the v1 branch has been moved to the master branch * a v1.1.0 tag has been added to signal the latest release Signed-off-by: Miek Gieben <miek@miek.nl> * Fix imports Signed-off-by: Miek Gieben <miek@miek.nl> * Group coredns/caddy with out plugins Signed-off-by: Miek Gieben <miek@miek.nl> * remove this file Signed-off-by: Miek Gieben <miek@miek.nl> * Relax import ordering github.com/coredns is now also a coredns dep, this makes github.com/coredns/caddy fit more natural in the list. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix final import Signed-off-by: Miek Gieben <miek@miek.nl>
health
Name
health - enables a health check endpoint.
Description
Enabled process wide health endpoint. When CoreDNS is up and running this returns a 200 OK HTTP status code. The health is exported, by default, on port 8080/health.
Syntax
health [ADDRESS]
Optionally takes an address; the default is :8080. The health path is fixed to /health. The
health endpoint returns a 200 response code and the word "OK" when this server is healthy.
An extra option can be set with this extended syntax:
health [ADDRESS] {
    lameduck DURATION
}
- Where lameduckwill make the process unhealthy then wait for DURATION before the process shuts down.
If you have multiple Server Blocks, health can only be enabled in one of them (as it is process wide). If you really need multiple endpoints, you must run health endpoints on different ports:
com {
    whoami
    health :8080
}
net {
    erratic
    health :8081
}
Doing this is supported but both endpoints ":8080" and ":8081" will export the exact same health.
Metrics
If monitoring is enabled (via the prometheus plugin) then the following metric is exported:
- coredns_health_request_duration_seconds{}- duration to process a HTTP query to the local- /healthendpoint. As this a local operation it should be fast. A (large) increase in this duration indicates the CoreDNS process is having trouble keeping up with its query load.
Note that this metric does not have a server label, because being overloaded is a symptom of
the running process, not a specific server.
Examples
Run another health endpoint on http://localhost:8091.
. {
    health localhost:8091
}
Set a lameduck duration of 1 second:
. {
    health localhost:8092 {
        lameduck 1s
    }
}