Scaleable service based architecture using docker swarm

Okay, I just noticed I still have no idea how this is supposed to work. Sorry for creating a second thread that fast but I am really confused right now.

I experimented lots and tried to set this up but right now I am at a point where I’m totally lost. I did something very similar with kubernetes and the technology shift is somehow very hard for me ^^. I’d be glad if you could tell me if this is possible or not and if its possible to give me a hint how to start. The containerized services are finished and working by the way.

This shows the behaviour of a single machine:

                                           [replica 2]
                                          /
                               [service a]
                              /           \
                             /             [replica 1]
[incoming traffic] -> [nginx]
                             \
                              [service b]-[replica 1]

This is my basic idea of how the service based cluster should work:

  • http://192.168.178.99/service_a is an incoming request.

  • The nginx got a config where all incoming requests on /service_a gets
    redirected to service a.

  • service a has some kind of load balancing
    behaviour and redirects this to one of the replica behind the
    service. The replicas can be added/removed dynamically.

Edit: Okay, so I just noticed that the service works as expected. When I keep refreshing the browser (which points to a service) multiple times (~50 times) the container behind it is changing. Am I able to make this happen way more frequently?