user3379502
user3379502

Reputation: 323

Canary Deployments using Nginx - traffic not routed to the Canary server

We have our services deployed in 4 application servers. We have 2 Nginx for load balancing. We are using 1 Consul server for service discovery. We dedicated one of the app server to be Canary server to test the canary deployments using the split_clients directive. Using the Nginx Template file we are controlling the traffic to the Canary VS non-Canary servers.

I have tested the service individually on all 4 servers using curl on the localhost. Then I tested the curl command on one of the Nginx server. I am getting the response but its being returned only from the non-canary app servers. There is no traffic routed to the Canary server.

the nginx.conf file is getting populated as below:

....
upstream canary_servers{
   server server4:port max_fails=3 fail_timeout=60 weight=1;
}

upstream non_canary_servers{
   server server1:port max_fails=3 fail_timeout=60 weight=1;
   server server2:port max_fails=3 fail_timeout=60 weight=1;
   server server3:port max_fails=3 fail_timeout=60 weight=1;
}

split_clients "app${remote_addr}${date_gmt}" $app_variant{
   * canary_servers;
   70% non_canary_servers;
}
.....

What can be the problem here? what am I missing?

Upvotes: 0

Views: 657

Answers (2)

user3379502
user3379502

Reputation: 323

The above problem is solved by using * or the actual %.

Upvotes: 0

Pixou
Pixou

Reputation: 1769

Try putting the asterix on the last line:

split_clients "app${remote_addr}${date_gmt}" $app_variant{
   70% non_canary_servers;
   * canary_servers;
}

Upvotes: 1

Related Questions