Creating a loadbalancer in Traefik

Loadbalancing across three servers with a weight and sticky sessions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
http:
  routers:
    pve-rtr:
      rule: "Host(`pve.{{env "DOMAINNAME_1"}}`)" 
      entryPoints:
        - websecure-external
        - websecure-internal
      middlewares:
        - chain-oauth
      service: pve-svc
      tls:
        certResolver: dns-cloudflare
        options: tls-opts@file
  services:
    pve-svc:
      loadBalancer:
        passHostHeader: true
        serversTransport: "pve-st"
        servers:
          - url: "https://10.54.7.11:8006" # https://IP-ADDRESS:PORT
            weight: 100
          - url: "https://10.54.7.12:8006" # Add another backend server
            weight: 10
          - url: "https://10.54.7.13:8006" # Add another backend server
            weight: 5
        healthCheck:
          path: "/" # or a specific health check path like /health
          interval: "15s"
          timeout: "3s"
        sticky:
          cookie: "PVE_SESSION" # Replace with your desired cookie name
  serversTransports:
    pve-st:
      insecureSkipVerify: true
Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy