consul-gc is a small daemon service that helps cleanup failed/lost Consul servers when running a Consul cluster within an AWS Auto Scaling Group. The need for consul-gc came from our attempts at running Consul in a kubernetes Deployment/StatefulSet but it should work in any EC2 cluster within an Auto Scaling Group.
Currently consul-gc takes a very opinionated view of your Consul cluster and assumes that the expected number of Consul servers is the same as the desired instance count of your Auto Scaling Group. Any additional Consul servers in the failed Serf state will be removed via the /v1/agent/force-leave api.
Usage of consul-gc:
-interval int
interval between checking members (default 60)
-v show version
Use the following environment variables for the consul agent connection:
CONSUL_HTTP_ADDRCONSUL_HTTP_TOKENCONSUL_HTTP_AUTHCONSUL_HTTP_SSLCONSUL_HTTP_SSL_VERIFY
These varaibles are used directly by the Consul Go api, so we recommend checking the consul docs for more information.