elvis-cai commented on issue #645:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/645#issuecomment-905067603


   kk, could have a look at this issue. 
   
   Another thing maybe not related to ingress controller, I did another test 
using apisix admin api, looks like rewrite host header support was added in 
May(https://github.com/apache/apisix/pull/4208), so I could access each node 
defined in upstream.nodes with its header separately.
   When testing the active health check, seems it is reading 
`upstream.checks.active.host`, if I miss this field, the active health check 
won't work as expected, so the idea is by default apisix gateway will load 
balancing each node, in this  case is apple and banana, if one of the node is 
unheathy, apisix will go to the healthy one only.
   
   Here's the colde I test:
   ```
   {
        "uri": "/*",
        "host": "httpbin.org",
           "upstream": {
        "pass_host": "node",
           "nodes": {
                "my.apple.com:80": 1,
                "my.banana.com:80": 1
           },
           "type": "roundrobin",
           "retries": 2,
           "checks": {
               "active": {
                   "timeout": 1,
                "http_path": "/",
                   "healthy": {
                       "interval": 2,
                       "successes": 1
                   },
                   "unhealthy": {
                       "interval": 1,
                       "http_failures": 2
                   },
                   "req_headers": ["User-Agent: curl/7.29.0"]
               },
               "passive": {
                   "healthy": {
                       "http_statuses": [200, 201],
                       "successes": 3
                   },
                   "unhealthy": {
                       "http_statuses": [500,503],
                       "http_failures": 1,
                       "tcp_failures": 3
                   }
               }
           }
       }
   }'
   ```
   
   when hitting apisix gateway with header `httpbin.org`, it can go to apple 
and banana randomly, when scale down apple instance, could get 503 issue,  
here's the testing code:
   
   ```
   for i in $(seq 1 1000); do curl  -H "Host: httpbin.org" 
${APISIX_GATEWAY_URL} ; done 
   <html>
   <head><title>503 Service Temporarily Unavailable</title></head>
   <body>
   <center><h1>503 Service Temporarily Unavailable</h1></center>
   <hr><center>nginx/1.17.7</center>
   </body>
   </html>
   <html>
   <head><title>503 Service Temporarily Unavailable</title></head>
   <body>
   <center><h1>503 Service Temporarily Unavailable</h1></center>
   <hr><center>nginx/1.17.7</center>
   </body>
   </html>
   banana
   <html>
   <head><title>503 Service Temporarily Unavailable</title></head>
   <body>
   <center><h1>503 Service Temporarily Unavailable</h1></center>
   <hr><center>nginx/1.17.7</center>
   </body>
   </html>
   banana
   banana
   banana
   ```
   
   here's the output when both apple and banana are runing:
   ```
   for i in $(seq 1 1000); do curl  -H "Host: httpbin.org" 
${APISIX_GATEWAY_URL}  ; done 
   apple
   banana
   apple
   apple
   apple
   banana
   banana
   apple
   apple
   apple
   banana
   banana
   apple
   banana
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to