Skip to content

moabukar/traefik-middlewares

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rate limit your Kubernetes applications with Codefresh and Traefik

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.

How to build and run the application container

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

Deploying to Kubernetes with Codefresh

There is a Codefresh pipeline for 2 environments (QA and Prod) that you can use at codefresh.yml

Deploying with rate limits

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

Test rate limiting

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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published