https://github.com/brainfair/istio-ratelimits
This repository demonstrates two approaches to implementing rate limiting in Istio: Local Rate Limiting and Global Rate Limiting
https://github.com/brainfair/istio-ratelimits
Last synced: 5 months ago
JSON representation
This repository demonstrates two approaches to implementing rate limiting in Istio: Local Rate Limiting and Global Rate Limiting
- Host: GitHub
- URL: https://github.com/brainfair/istio-ratelimits
- Owner: brainfair
- License: apache-2.0
- Created: 2025-01-22T11:55:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-01T13:17:51.000Z (8 months ago)
- Last Synced: 2025-11-01T15:11:51.163Z (8 months ago)
- Language: YAML
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Istio Rate Limiting Examples
This repository demonstrates two approaches to implementing rate limiting in Istio: Local Rate Limiting and Global Rate Limiting. These examples showcase how to manage traffic flow and protect services from excessive requests using Istio's Envoy filters.
## Overview
Rate limiting in Istio helps control the number of requests sent to a service to prevent overloading and ensure fair usage. The two approaches covered in this repository are:
- **Local Rate Limiting**: Enforces rate limits at the sidecar proxy level, where each instance of a service independently applies the configured limits.
- **Global Rate Limiting**: Enforces rate limits across all instances on a Gateway level of a service using a centralized Redis-based rate-limiting mechanism.
## Deploy
This configuration can be deployed as is with [FluxCD example](https://github.com/brainfair/awesome-flux-head/blob/main/clusters/homelab/02-istio-ratelimits.yaml) or just with kubectl (make sure that you replaced subdomain placeholders before).
## Run Tests
Tests are provided using the k6 framework in the ```test.js``` and ```test-cookies.js``` files located inside each example directory. The tests target the configured rate-limited path (```/headers```) and validate the ```custom-header``` value, and per cookie value ```TEST```.
You can run the tests using the Makefile commands inside each directory example:
```
## Common tests with rate limiter per path and header value
make test111 # Runs the test with custom-header set to 111
make test222 # Runs the test with custom-header set to 222
## Global rate limit test per cookie rate limiter
make test-cookie
```