Nginx入口控制器速率限制不起作用

时间:2019-01-29 02:21:13

标签: kubernetes-ingress

  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/limit-connection: "1"
    nginx.ingress.kubernetes.io/limit-rpm: "20"

和容器图片版本,我正在使用, 图片:quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.22.0

尝试在十分钟的范围内发送200个请求(每分钟就好像是来自单个ipaddress的20个请求),然后必须拒绝请求。

3 个答案:

答案 0 :(得分:0)

尝试将此limit-connection:更改为limit-connections:

有关更多信息,请检查this

如果没有帮助,请输入命令或说明如何测试连接限制。

答案 1 :(得分:0)

I changed it to the limit-connections, I am mentioning the annotations in the ingress yml file and applying it and i can in the nginx conf the following 

`worker_rlimit_nofile 15360;
    limit_req_status                503;
    limit_conn_status               503;
    # Ratelimit test_nginx
    # Ratelimit test_nginx `
   ` map $whitelist_xxxxxxxxxxxx $limit_xxxxxxxxxx {
    limit_req_zone $limit_xxxxxxxx zone=test_nginx_rpm:5m rate=20r/m;
            limit_req zone=test_nginx_rpm burst=100 nodelay;
            limit_req zone=test_nginx_rpm burst=100 nodelay;
            limit_req zone=test_nginx_rpm burst=100 nodelay;`


when i kept this annotations, 

 ` nginx.ingress.kubernetes.io/limit-connections: "1" 
  nginx.ingress.kubernetes.io/limit-rpm: "20" `

I can see the above burst and other things in the nginx conf file, can you please tell me these make any differences ?

答案 2 :(得分:0)

您使用的是哪个nginx入口版本?请使用quay.io/aledbf/nginx-ingress-controller:0.415,然后进行检查,也请查看此链接-https://github.com/kubernetes/ingress-nginx/issues/1839