Traefik as a reverse proxy on Kubernetes

I will present an example of the configuration, using traefik as a reverse proxy in Kubernetes instead of in Kubernetes mode.

Deployment settings

- image: traefik:v2.2.5
name: traefik-proxy
cpu: 0.1
memory: 128Mi
- "sh"
- "-c"
- "traefik"

Traefik settings

Example of toml which is using for running traefik as a reverse proxy:

apiVersion: v1
kind: ConfigMap
name: traefik-proxy-config
traefik.toml: |
defaultEntryPoints = ["http","https"]
logLevel = "INFO"

address = ":80"

address = ":443"

entrypoints = ["http"]
backend = "some_back_end"

passHostHeader = true
weight = 1
url = "http://some-service:80"

format = "json"
filePath = "/mnt/log/access.log"

Explanations of settings

  • [file]Is required when setting forntend/backend in file
  • passHostHeader = trueIf not set, the Host header will be cut off, so depending on the configuration it will be addicted
  • some_front_end, some_back_end, some_servicecan be replaced with any name
  • If you do not describe the load-balancing method, the default load-balancing wrr. Therefore, weight=Nsetting of mandatorywrrthis is Weighted Round-robin



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

DevOps Consultant. I’m strongly focused on automation, security, and reliability.