Zero-downtime upgrades with AWS Elastic Loadbalancers (ELBs) and Haproxy
I have a Classic Loadbalancer configured in my infrastructure with Terraform:
resource "aws_elb" "ingress" {
(...)
Regular traffic:
listener {
lb_port = 80
lb_protocol = "tcp"
instance_port = 8888
instance_protocol = "tcp"
}
listener {
lb_port = 443
lb_protocol = "tcp"
instance_port = 8889
instance_protocol = "tcp"
}
Haproxy dashboard answers on / on port 8887
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:8887/healthy"
interval = 5
}
instances = flatten([
aws_instance.nomadclient-01.id,
aws_instance.nomadclient-02.id,
aws_instance.nomadclient-03.id
])
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
}
Notice how the health_check
is defined, but also how connection_draining
is...