Global Traffic Managment (GTM) service which can provide health check aware responses to DNS queries.
The Go version of this project is now located here: https://github.com/allyn-bottorff/OpenGTM-Go
This project is a proof-of-concept. It works, but has some limitations and sharp edges, especially in the gtm CoreDNS plugin.
-
HTTP(S) health checks
-
Configurable HTTPS validity
-
Health status by HTTP return code or string matching
-
-
Fallback IP
-
TCP health checks
-
Connection success/failure
-
-
CoreDNS plugin
-
DNS responses based on the health_checker
-
-
Rust health checking service
-
Axum API framework
-
Tokio-based asynchronous health checking tasks
-
-
CoreDNS plugin
-
Makes API calls to the health checking service to determine the correct answer to a DNS query
-
The project expects a config file conf.json in the same directory of the
binary. In the future, this path will be configurable.
cargo runHealth Checker currently uses env_logger for setting the log level. E.g.
RUST_LOG=info cargo runThe second component of this service is a plugin for CoreDNS which takes DNS requests and translates them into HTTP API calls to the health checker service.
To add this plugin, you will need to build CoreDNS itself with a modified config file.
-
Add
gtm:gtmto the top plugin list inplugin.cfg -
Add a new directory for the GTM plugin:
mkdir -p plugin/gtm -
Inside
plugin/gtmsymlinkgtm.gofrom this repository into that directory. -
Build the coredns project (from the root of the repository):
-
go generate -
go build
-
-
Add a
Corefileto the root of the repository with a configuration which adds the new gtm plugin (e.g.):Corefile:./Corefile. { gtm } -
Run coredns:
./coredns
|
Important
|
As it is currently configured, the plugin assumes that the health
checker is running at http://127.0.0.1:8080. In the future, that will be
configurable via options in the Corefile. For now, however, if you need to
change the running location the health_checker service, you’ll need to edit it
directly in the plugin.
|
This sample config can be used to run the project.
./conf.json{
"pools": [
{
"name": "lbtests1",
"port": 8080,
"members": [
"127.0.0.2",
"127.0.0.3"
],
"fallback_ip": "127.0.0.0",
"interval": 30,
"poll_type": "TCP"
},
{
"send": "/health",
"name": "lbtests2",
"port": 8080,
"members": [
"127.0.0.4",
"127.0.0.5"
],
"fallback_ip": "127.0.0.0",
"interval": 30,
"poll_type": "HTTP",
"http_options": {
"send": "/health",
"https_enabled": false,
"https_require_validity": false,
"receive_up": {
"status_codes": [
200,
503
]
}
}
},
{
"send": "/health",
"name": "lbtests3",
"port": 8080,
"members": [
"127.0.0.6",
"127.0.0.7"
],
"fallback_ip": "127.0.0.0",
"interval": 30,
"poll_type": "HTTP",
"http_options": {
"send": "/health",
"https_enabled": false,
"receive_up": {
"string": "Healthy"
}
}
}
]
}