简体   繁体   English

nginx 入口速率限制

[英]nginx ingress rate limiting

i am not able to understand one point in the rate-limiting of Nginx ingress我无法理解Nginx 入口速率限制中的一点

i was referring to one article regarding rate limiting with nginx ingress: https://medium.com/titansoft-engineering/rate-limiting-for-your-kubernetes-applications-with-nginx-ingress-2e32721f7f57#:~:text=When%20we%20use%20NGINX%20ingress,configure%20rate%20limits%20with%20annotations.&text=As%20an%20example%20above%2C%20the,qps )%20on%20the%20Hello%20service.我指的是一篇关于使用 nginx 入口进行速率限制的文章: https://medium.com/titansoft-engineering/rate-limiting-for-your-kubernetes-applications-with-nginx-ingress-2e32721f7f57#:当%20we%20use%20NGINX%20ingress,配置%20rate%20limits%20with%20annotations.&text=As%20an%20example%20above%2C%20the,qps )%20on%20the%20Hello%20service。

in limitation section at last最后在限制部分

It applies to the whole ingress and is not able to configure exceptions, eg.它适用于整个入口,并且无法配置异常,例如。 when you want to exclude a health check path /healthz from your service.当您想从服务中排除健康检查路径 /healthz 时。

if i am creating two ingresses with different names , one has path /hello1 and another /hello2 both pointing to the same service backend .如果我正在创建两个具有不同名称的入口,一个具有路径/hello1另一个/hello2都指向同一个服务后端

Now if i am adding rate limiting to only one ingress or path /hello1 will it affect another?现在,如果我只对一个入口或路径/hello1添加速率限制,它会影响另一个吗? if the same host or domain is there???如果存在相同的主机或域???

ingress 1 : example.com/hello1 - rate-limit set入口 1example.com/hello1 - 速率限制集

ingress 2 : example.com/hello2 no rate limiting入口 2example.com/hello2无速率限制

Thanks in advance提前致谢

Rate limit will be applied only to that ingress where you specified it.速率限制将仅应用于您指定的入口。 What is basically nginx-ingress doing in the background - it merges rules into 1 huge config, however they applies to different objects.基本上 nginx-ingress 在后台做什么 - 它将规则合并到 1 个巨大的配置中,但是它们适用于不同的对象。

eg 2 different ingresses for same host and diff path.例如,相同主机和差异路径的 2 个不同入口。

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test1
  annotations:
    kubernetes.io/ingress.class: 'nginx'
    nginx.ingress.kubernetes.io/limit-rps: '5'
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /path1
        backend:
          serviceName: service1
          servicePort: 8080

and

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test2
  annotations:
    kubernetes.io/ingress.class: 'nginx'
    nginx.ingress.kubernetes.io/limit-rps: '10'
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /path2
        backend:
          serviceName: service1
          servicePort: 8080

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM