Autoscaling Docker Nodes

Опубликовано: 28 Октябрь 2024
на канале: Mark Bulmer
266
2

Due to traffic, you may want to upgrade or downgrade the size of your swarm in real time...the container services operate as usual between the two nodes being shifted for balance. If you start a 4-container service with a two-node swarm, you'll probably find two nodes on each node. When the computers can no longer handle traffic they scale up (with a cloudwatch notification, that sends an SNS message to a topic based on a reached threshold of CPU utilization), and that starts an autoscaling action, that easily joins a new node to a swarm (to allow containers then to balance to the new Node....making more cpu available per container in the swarm).

In this demo , we begin with a one-node swarm, that has to get 'scaled up' to two nodes . An autoscaling group is not actually used in this demo, but we create the launch template that functions, and that launch template can be the basis for an autoscaling group. If you can do what I'm doing in the video, you could conceivably scale up to 50 nodes for example, depending what your needs are). The trick is to pull the bash file that has the join token from s3, while pushing it initially from the master node to s3. Avoid cutting and pasting the join token out of the original master node, and instead move the file immediately to s3 from that node using AWS-CLI.