Rate limits for APIs
Control how many requests within a time period are allowed to your APIs, such as 100 requests per minute.
Set rate limits for your API products to control how many requests within a time period are allowed to your API products. The rate limits form a key part of the usage plan for your API products. For more information about the Gloo rate limiting add-on, see Rate limit.
Before you begin
Make sure that the required Gloo components are running. These include the portal server, rate limiter, external auth service, and for dynamic rate limiting, the
logs/istio_access_logs
telemetry collector pipeline and portal-related dynamic metadata access log formatting in the Istio operator specification.kubectl get pods -A -l app=gloo-mesh-portal-server kubectl get pods -A -l app=ext-auth-service kubectl get pods -A -l app=rate-limiter kubectl get -A istiooperator -l reconciler.mesh.gloo.solo.io/name=istio-lifecycle -o yaml
Create your APIs, including the Gloo ApiDocs that describe the stitched schema.
Bundle your APIs into API products by using a route table.
Get the labels of your routes to use to apply policies to, such as with the example query.
kubectl get rt -n gloo-mesh-gateways -o=jsonpath='{range .items[*]}[{.metadata.name}, {.spec.http[*].name}, {.spec.http[*].labels}]{"\n"}{end}'
Example output:
- The
api-example-com-rt
route table does not have any route-level labels. To apply policies, you can add labels to those routes. - The
petstore-rt
route table has ausagePlans: dev-portal
label on itspets-api
,users-api
, andstore-api
routes. - The
tracks-rt
route table has ausagePlans: dev-portal
label on itstracks-api
route.
[api-example-com-rt, , ] [petstore-rt, pets-api users-api store-api, {"usagePlans":"dev-portal"} {"usagePlans":"dev-portal"} {"usagePlans":"dev-portal"} ] [tracks-rt, tracks-api, {"usagePlans":"dev-portal"}]
- The
Basic rate limiting
Control how many requests within a time period are allowed to your APIs, such as 100 requests per minute.
For instructions, follow the Set up rate limiting guide in the Protect your APIs tutorial.
Update the
RateLimitClientConfig
based on the type of external auth policy that you applied: API key or OAuth.