2

There will be a web application served by gunicorn with pod instantiated in every node in Kubernetes cluster. External load balancer (limited to the round-robin or least connections methods) drives the traffic to nginx service (also instantiated in a pod in every node).

After an initial request all subsequent request should go to the same server, something that nginx service in pod solves with the following configuration:

http {
    upstream backend {
        ip_hash;
        server backend1.example.com;
        server backend2.example.com;
        server backend3.example.com;
    }
    
    server {
        location / {
            proxy_pass http://backend;
        }
    }
}

The question and problem are how to send a user to the right server upon the first request, the request that will set that value for the ip_hash method allowing subsequent requests to be served from the same server?

So, when a request goes to backend1.example.com it may accept it or refuse it based on the user category. Every node knows what the right category/server is so each nginx pod can redirect to the correct server.

What will be the best practice for solving something like this?

ipaleka
  • 121
  • 4

0 Answers0