I'm trying to create a proxy in front of a swarm cluster.
This proxy is inside of another swarm cluster, to provide HA.
This is the current structure:
- Proxy cluster (ip range 192.168.98.100 ~ 192.168.98.102)
- proxy-manager1;
- proxy-worker1;
- proxy-worker2;
- App cluster (ip range 192.168.99.100 ~ 192.168.99.107)
- app-manager1;
- app-manager2;
- app-manager3;
- app-worker1;
- app-worker2;
- app-worker3;
- app-worker4;
- app-worker5;
When I configure nginx with the app-manager's IP address, the proxy redirection works good.
But when I configure nginx with the app-manager's hostname or DNS, the proxy service does not find the server to redirect.
This is the working config file:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream app {
server 192.168.99.100:8080;
server 192.168.99.101:8080;
server 192.168.99.102:8080;
}
server {
listen 80;
location / {
proxy_pass http://app;
}
}
}
Is that a good practice? Or maybe I'm doing wrong?