Search code examples
kubernetesingress-nginx

How to set limit_req_zone size through ingress-nginx annotations?


When I set a rate limit through annotations, like:

nginx.ingress.kubernetes.io/limit-rpm: '50'

It defines a zone like:

limit_req_zone $limit_XYZ zone=XYZ_rpm:5m rate=50r/m;

But it always sets the zone size as 5m. How do I increase the size from 5m to something else?


Solution

  • These annotations are only limited for connections and transmission rates, to set the size of the shared memory zone it must be configured through ConfigMap by changing the zone size directly zone=name:size make sure to use unit-m(megabyte). Please see sample configmap below:

    image

    Additionally, based on this blog the limit_req_zone directive sets the parameters for rate limiting and the shared memory zone, but it does not actually limit the request rate.