Rate Limiting is a technique for controlling the rate of requests to your application.
It can save you from denial of service attacks or resource starvation problems.
Traefik is a proxy that supports rate limiting out of the box and can also work as a Kubernetes ingress.
Run
cd simple-web-app
docker build . -t my-app
docker run -p 8080:8080 my-app
then visit http://localhost:8080 in your browser
You can find prebuilt images at https://hub.docker.com/r/kostiscodefresh/traefik-demo-app
There is a Codefresh pipeline for 2 environments (QA and Prod) that you can use at codefresh.yml
First install traefik in your cluster
helm repo add traefik https://helm.traefik.io/traefik
kubectl create ns traefik
helm install --namespace=traefik traefik traefik/traefik
Create the two namespaces
kubectl create ns qa
kubectl create ns prod
Deploy using Codefresh or manually with
kubectl apply -f manifests-qa/* -n qa
kubectl apply -f manifests-prod/* -n prod
You can use several testing tools such as
Example with siege
siege -c 10 -r 20 http://kostis-eu.sales-dev.codefresh.io/prod
siege -c 10 -r 20 http://kostis-eu.sales-dev.codefresh.io/qa
In the second run you should see responses with HTTP code 429 (too many requests).