I'm using Traefik as a load balancer and I'm trying to write a health check, which will monitor servers within the load balancer service.
I have multiple Traefik instances in different locations and a CDN. I need to configure the CDN to check the health of Traefik service to route traffic to.
Example:
Global CDN ----> Traefik 1
---> Backend A
---> Backend B
----> Traefik 2
---> Backend C
---> Backend D
I want to check the service has healthy backends. Checking the status/health of the Traefik instance itself is not enough.
You've tagged
fastlyso I'm presuming Fastly is the CDN you're using.I'm responding specifically to the question:
Although I would expect Traefik to handle health check monitoring of its own backends, you could setup a health check for those backends within the CDN.
Here is an example, where I define two backends:
You also can see in the above image that I've added a health check to "Traefik Backend".
Below is some custom VCL that sets "Traefik Proxy" as the backend the CDN should send all incoming requests onto. It then checks if "Traefik Backend" is healthy, and if it isn't, then you can write whatever custom VCL is necessary to indicate that to the "Traefik Proxy" backend.
Here are some references that might be useful to you: