1. The document describes a process for implementing rolling upgrades in a containerized environment using Mesos, Marathon, Docker, and HAProxy.
2. The process involves deploying new application instances with a minimum number of instances, adding them to the load balancer pool after health checks pass, then disabling and removing old instances one by one while adding more new instances.
3. This continues until all old instances are removed and new instances are live, at which point the old application can be deleted.
2. 1. Deploy NEW application (with a new App ID) with the minimum set of instances (eg: 1 in the beginning)
as needed to manage the traffic
2. Wait for the NEW instance(s) to go healthy
3. Add the NEW Instance(s) to the HAProxy Pool
4. Load gets balanced between OLD and NEW Pool
5. DISABLE one of the OLD instances in the HAProxy Pool
6. Wait for the HAProxy Connection to drain on the Disabled OLD Instance
7. After waiting period is over, Remove the Disabled OLD Instance by issuing Docker STOP on the
Container
8. Scale the NEW Instances and let them add to the HAProxy Pool
9. Repeat the steps 4 - 8 till all OLD instances are removed, and all the NEW instances are added to
HAProxy
10. Delete the OLD Application
ALGORITHM: Rolling Upgrades
3. OLD OLD OLD OLD OLD OLD
HAProxy
CURRENT STATUS
Old Instances are running and load balanced by HAProxy
4. OLD OLD OLD OLD OLD OLD
HAProxy
L4
DNS
Customer
Service Port 1
CURRENT STATUS
Old Instances are running and
load balanced by HAProxy
5. NEWOLD OLD OLD OLD OLD OLD
HAProxy
Minimum
required to
serve just
enough traffic
NEW INSTANCE DEPLOYED
1 Instance of the New Version of Application is deployed
6. NEWOLD OLD OLD OLD OLD OLD
HAProxy
NEW INSTANCE DEPLOYED
Health Check Passed
7. NEWOLD OLD OLD OLD OLD OLD
HAProxy
NEW INSTANCE DEPLOYED
Health Check Passed. Added to Load Balancer.
One Old Instance is DISABLED from Load Balancer
8. OLD OLD OLD OLD OLD OLD
HAProxy
L4
DNS
Customer
Service Port 1
NEW
NEW INSTANCE
DEPLOYED
Added to Load
Balancer. 16% new
requests goes to NEW
Instance.
No New Request will
go to Old Instance #1
disabled
9. NEWOLD OLD OLD OLD OLD OLD
HAProxy
ZDD
Control
Marathon
Mesos
Control
HOW IS
ROLLING
UPGRADE
IMPLEMENTED
ZDD requests HAProxy
to DISABLE one of the
OLD Instance
ZDD is a Python Script part of the Marathon-lb Project from Mesosphere
disabled
10. NEWOLD OLD OLD OLD OLD OLD
HAProxy
ZDD
Control
Marathon
Mesos
Control
HOW IS
ROLLING
UPGRADE
IMPLEMENTED
ZDD now waits for N
seconds to drain any
existing connections
N
seconds
11. NEWOLD OLD OLD OLD OLD OLD
HAProxyMesos
STOP
ZDD
Control
Marathon
Control
HOW IS
ROLLING
UPGRADE
IMPLEMENTED
After N seconds, ZDD
requests Marathon to
STOP one of the Old
Instances
12. NEWOLD OLD OLD OLD OLD OLD
HAProxyMesos
STOP
M
seconds
ZDD
Control
Marathon
Control
HOW IS
ROLLING
UPGRADE
IMPLEMENTED
Mesos invokes Docker
STOP on the Old
Container, and waits
for M seconds
13. NEWOLD OLD OLD OLD OLD
HAProxyMesos
M
seconds
STOP
N
seconds
OLD
14. NEW NEWOLD OLD OLD OLD OLD
HAProxyMesos
M
seconds
STOP
N
seconds
15. NEW NEWOLD OLD OLD OLD
HAProxy
M
seconds
Mesos
STOP
NEW
N
seconds
16. NEW NEWOLD OLD OLD
HAProxy
M
seconds
Mesos
STOP
NEWNEW
N
seconds
22. APP APP APP APP APP APP
HAProxy
ZDD
Control
Marathon
Mesos
Control
DEV TEST STAGING PROD JENKINS
PIPELINE
ROLLING
UPGRADES
HAPPEN ACROSS
ALL ENVIRONMENT
ZDD orchestrates
the deployment