Skip to content

Implement Auto Scaling for Docker Swarm Services #78

@Isaac-Andradee

Description

@Isaac-Andradee

As we know, Docker Swarm has no way to auto-scale our services natively. So we need to implement it manually based on resource usage metrics (CPU and Memory), to ensure high availability and automatic adjustment according to demand.

So here are the rules that were decided for this implementation:

  • Metrics monitoring with Prometheus + cAdvisor
  • Prometheus alert rules for high CPU/memory usage
  • Autoscaler service (container) that receives alerts via Alertmanager webhook
  • Scaling script to adjust service replicas in Swarm using Docker CLI
  • Secure authentication between Alertmanager and autoscaler (bearer token)
  • Optimized Dockerfile for autoscaler using Python + Gunicorn
  • Alertmanager webhook configured to call autoscaler endpoint
  • Automated tests for auto scaling validation

Note

If you have any ideas of what other type of technology could be implemented, feel free to share.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions