create docker swarm on AWS

Viewed 155

I created 3 ec2 instances and now I want to create a docker swarm

the ec2 instances have a security group with

TCP 2377    0.0.0.0/0

TCP 7946    0.0.0.0/0

TCP 8501    0.0.0.0/0

UDP 4789    0.0.0.0/0

UDP 7946    0.0.0.0/0

SSH 7946    0.0.0.0/0

HTTPS   443 0.0.0.0/0

HTTP    80  0.0.0.0/0

open

after creating the resources I run the following code

docker swarm init --advertise-addr ManagerIP

and then on the other instance I past the join command

I then create a network and 2 services

docker network create --driver overlay mydrupal

docker service create --name psql --network mydrupal -e POSTGRES_PASSWORD=postgres postgres:11

docker service create --name drupal --network mydrupal -p 80:80 drupal:8

all this at the moment is running either on host1 (the swarm leader) or host1 and host2 (one of the workers)

If I then go to the browser and paste the public ip of the ec2 and trying to configure the postgres database init I get an error or I can get in and then I cannot connect from the other instances...

I am not sure if this is a security group issue or something else.



update

If I remove the workers from the swarm I can configure the database and run drupal

If then I add the workers to the swarm I can't connect using their public ips


update2

opened all traffic, all ports on the security group and still nothing..

0 Answers
Related