Migration Guide: From v1 to v2

    The version 2 of Traefik introduces a number of breaking changes,which require one to update their configuration when they migrate from v1 to v2.The goal of this page is to recapitulate all of these changes, and in particular to give examples,feature by feature, of how the configuration looked like in v1, and how it now looks like in v2.

    Migration Helper

    We created a tool to help during the migration: traefik-migration-tool

    This tool allows to:

    • convert to Traefik IngressRoute resources.
    • convert acme.json file from v1 to v2 format.
    • migrate the static configuration contained in the file traefik.toml to a Traefik v2 file.

    During the transition from v1 to v2, a number of internal pieces and components of Traefik were rewritten and reorganized.As such, the combination of core notions such as frontends and backends has been replaced with the combination of , services, and .

    Typically, a router replaces a frontend, and a service assumes the role of a backend, with each router referring to a service.However, even though a backend was in charge of applying any desired modification on the fly to the incoming request,the router defers that responsibility to another component.Instead, a dedicated middleware is now defined for each kind of such modification.Then any router can refer to an instance of the wanted middleware.

    One frontend with basic auth and one backend, become one router, one service, and one basic auth middleware.

    v1

    1. apiVersion: extensions/v1beta1
    2. kind: Ingress
    3. metadata:
    4. name: traefik
    5. namespace: kube-system
    6. annotations:
    7. kubernetes.io/ingress.class: traefik
    8. traefik.ingress.kubernetes.io/rule-type: PathPrefix
    9. spec:
    10. rules:
    11. - host: test.locahost
    12. http:
    13. paths:
    14. - path: /test
    15. backend:
    16. serviceName: server0
    17. servicePort: 80
    18. - path: /test
    19. backend:
    20. serviceName: server1
    21. servicePort: 80

    1. [frontends]
    2. [frontends.frontend1]
    3. entryPoints = ["http"]
    4. backend = "backend1"
    5. [frontends.frontend1.routes]
    6. [frontends.frontend1.routes.route0]
    7. rule = "Host:test.localhost"
    8. [frontends.frontend1.routes.route0]
    9. rule = "PathPrefix:/test"
    10. [frontends.frontend1.auth]
    11. [frontends.frontend1.auth.basic]
    12. users = [
    13. "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
    14. "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
    15. ]
    16. [backends]
    17. [backends.backend1]
    18. [backends.backend1.servers.server0]
    19. url = "http://10.10.10.1:80"
    20. [backends.backend1.servers.server1]
    21. url = "http://10.10.10.2:80"
    22. [backends.backend1.loadBalancer]
    23. method = "wrr"

    v2

    1. labels:
    2. - "traefik.http.routers.router0.rule=Host(`bar.com`) && PathPrefix(`/test`)"
    3. - "traefik.http.routers.router0.middlewares=auth"
    4. - "traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0"

    1. # The definitions below require the definitions for the Middleware and IngressRoute kinds.
    2. # https://docs.traefik.io/v2.0/providers/kubernetes-crd/#traefik-ingressroute-definition
    3. apiVersion: traefik.containo.us/v1alpha1
    4. kind: Middleware
    5. metadata:
    6. name: basicauth
    7. namespace: foo
    8. spec:
    9. basicAuth:
    10. users:
    11. - test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/
    12. - test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0
    13. ---
    14. apiVersion: traefik.containo.us/v1alpha1
    15. kind: IngressRoute
    16. metadata:
    17. name: ingressroutebar
    18. spec:
    19. entryPoints:
    20. - http
    21. routes:
    22. - match: Host(`test.localhost`) && PathPrefix(`/test`)
    23. kind: Rule
    24. services:
    25. - name: server0
    26. port: 80
    27. - name: server1
    28. port: 80
    29. middlewares:
    30. - name: basicauth
    31. namespace: foo

    1. [http.routers]
    2. [http.routers.router0]
    3. rule = "Host(`test.localhost`) && PathPrefix(`/test`)"
    4. middlewares = ["auth"]
    5. service = "my-service"
    6. [http.services]
    7. [[http.services.my-service.loadBalancer.servers]]
    8. url = "http://10.10.10.1:80"
    9. [[http.services.my-service.loadBalancer.servers]]
    10. url = "http://10.10.10.2:80"
    11. [http.middlewares]
    12. [http.middlewares.auth.basicAuth]
    13. users = [
    14. "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
    15. "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
    16. ]

    1. http:
    2. routers:
    3. router0:
    4. rule: "Host(`test.localhost`) && PathPrefix(`/test`)"
    5. service: my-service
    6. middlewares:
    7. - auth
    8. services:
    9. my-service:
    10. loadBalancer:
    11. servers:
    12. - url: http://10.10.10.1:80
    13. - url: http://10.10.10.2:80
    14. middlewares:
    15. auth:
    16. basicAuth:
    17. users:
    18. - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"
    19. - "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"

    TLS Configuration Is Now Dynamic, per Router.

    TLS parameters used to be specified in the static configuration, as an entryPoint field.With Traefik v2, a new dynamic TLS section at the root contains all the desired TLS configurations.Then, a can refer to one of the TLS configurations defined at the root, hence defining the for that router.

    TLS on web-secure entryPoint becomes TLS option on Router-1

    v1

    1. # static configuration
    2. [entryPoints]
    3. [entryPoints.web-secure]
    4. address = ":443"
    5. [entryPoints.web-secure.tls]
    6. minVersion = "VersionTLS12"
    7. cipherSuites = [
    8. "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
    9. "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
    10. "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
    11. "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
    12. "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
    13. "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
    14. ]
    15. [[entryPoints.web-secure.tls.certificates]]
    16. certFile = "path/to/my.cert"
    17. keyFile = "path/to/my.key"

    1. --entryPoints='Name:web-secure Address::443 TLS:path/to/my.cert,path/to/my.key TLS.MinVersion:VersionTLS12 TLS.CipherSuites:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256'

    v2

    1. # dynamic configuration
    2. [http.routers]
    3. [http.routers.Router-1]
    4. rule = "Host(`bar.com`)"
    5. service = "service-id"
    6. # will terminate the TLS request
    7. [http.routers.Router-1.tls]
    8. options = "myTLSOptions"
    9. [[tls.certificates]]
    10. certFile = "/path/to/domain.cert"
    11. keyFile = "/path/to/domain.key"
    12. [tls.options]
    13. [tls.options.default]
    14. minVersion = "VersionTLS12"
    15. [tls.options.myTLSOptions]
    16. minVersion = "VersionTLS13"
    17. cipherSuites = [
    18. "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
    19. "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
    20. "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
    21. "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
    22. "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
    23. "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
    24. ]

    1. http:
    2. routers:
    3. Router-1:
    4. rule: "Host(`bar.com`)"
    5. service: service-id
    6. # will terminate the TLS request
    7. tls:
    8. options: myTLSOptions
    9. tls:
    10. certificates:
    11. - certFile: /path/to/domain.cert
    12. keyFile: /path/to/domain.key
    13. options:
    14. myTLSOptions:
    15. minVersion: VersionTLS13
    16. cipherSuites:
    17. - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    18. - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
    19. - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
    20. - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
    21. - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

    1. # The definitions below require the definitions for the TLSOption and IngressRoute kinds.
    2. # https://docs.traefik.io/v2.0/providers/kubernetes-crd/#traefik-ingressroute-definition
    3. apiVersion: traefik.containo.us/v1alpha1
    4. kind: TLSOption
    5. metadata:
    6. name: mytlsoption
    7. namespace: default
    8. spec:
    9. minVersion: VersionTLS13
    10. cipherSuites:
    11. - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    12. - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
    13. - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
    14. - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
    15. - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    16. ---
    17. apiVersion: traefik.containo.us/v1alpha1
    18. kind: IngressRoute
    19. metadata:
    20. name: ingressroutebar
    21. spec:
    22. entryPoints:
    23. - web
    24. routes:
    25. - match: Host(`bar.com`)
    26. kind: Rule
    27. - name: whoami
    28. port: 80
    29. tls:
    30. options:
    31. name: mytlsoption

    1. labels:
    2. # myTLSOptions must be defined by another provider, in this instance in the File Provider.
    3. # see the cross provider section
    4. - "[email protected]"

    HTTP to HTTPS Redirection Is Now Configured on Routers

    Previously on Traefik v1, the redirection was applied on an entry point or on a frontend.With Traefik v2 it is applied on a Router.

    To apply a redirection, one of the redirect middlewares, or RedirectScheme, has to be configured and added to the router middlewares list.

    HTTP to HTTPS redirection

    v1

    1. # static configuration
    2. defaultEntryPoints = ["http", "https"]
    3. [entryPoints]
    4. [entryPoints.http]
    5. address = ":80"
    6. [entryPoints.http.redirect]
    7. entryPoint = "https"
    8. [entryPoints.https]
    9. address = ":443"
    10. [entryPoints.https.tls]
    11. [[entryPoints.https.tls.certificates]]
    12. certFile = "examples/traefik.crt"
    13. keyFile = "examples/traefik.key"

    1. --entrypoints=Name:web Address::80 Redirect.EntryPoint:web-secure
    2. --entryPoints='Name:web-secure Address::443 TLS:path/to/my.cert,path/to/my.key'

    v2

    1. labels:
    2. - traefik.http.routers.web.rule=Host(`foo.com`)
    3. - traefik.http.routers.web.entrypoints=web
    4. -
    5. - traefik.http.routers.web-secured.rule=Host(`foo.com`)
    6. - traefik.http.routers.web-secured.entrypoints=web-secure
    7. - traefik.http.routers.web-secured.tls=true

    1. apiVersion: traefik.containo.us/v1alpha1
    2. kind: IngressRoute
    3. metadata:
    4. name: http-redirect-ingressRoute
    5. spec:
    6. entryPoints:
    7. - web
    8. routes:
    9. - match: Host(`foo.com`)
    10. kind: Rule
    11. services:
    12. - name: whoami
    13. port: 80
    14. middlewares:
    15. - name: redirect
    16. ---
    17. apiVersion: traefik.containo.us/v1alpha1
    18. kind: IngressRoute
    19. metadata:
    20. name: https-ingressRoute
    21. spec:
    22. entryPoints:
    23. - web-secure
    24. routes:
    25. - match: Host(`foo`)
    26. kind: Rule
    27. services:
    28. - name: whoami
    29. port: 80
    30. tls: {}
    31. ---
    32. apiVersion: traefik.containo.us/v1alpha1
    33. kind: Middleware
    34. metadata:
    35. name: redirect
    36. spec:
    37. redirectScheme:
    38. scheme: https
    1. ## static configuration
    2. # traefik.toml
    3. [entryPoints.web]
    4. address = ":80"
    5. [entryPoints.web-secure]
    6. address = ":443"
    7. ##---------------------##
    8. ## dynamic configuration
    9. # dynamic-conf.toml
    10. [http.routers]
    11. [http.routers.router0]
    12. rule = "Host(`foo.com`)"
    13. service = "my-service"
    14. entrypoints = ["web"]
    15. middlewares = ["redirect"]
    16. [http.routers.router1]
    17. rule = "Host(`foo.com`)"
    18. service = "my-service"
    19. entrypoints = ["web-secure"]
    20. [http.routers.router1.tls]
    21. [http.services]
    22. [[http.services.my-service.loadBalancer.servers]]
    23. url = "http://10.10.10.1:80"
    24. [[http.services.my-service.loadBalancer.servers]]
    25. url = "http://10.10.10.2:80"
    26. [http.middlewares]
    27. [http.middlewares.redirect.redirectScheme]
    28. scheme = "https"
    29. [[tls.certificates]]
    30. certFile = "/path/to/domain.cert"
    31. keyFile = "/path/to/domain.key"

    Strip and Rewrite Path Prefixes

    With the new core notions of v2 (introduced earlier in the section),transforming the URL path prefix of incoming requests is configured with middlewares,after the routing step with .

    Use Case: Incoming requests to http://company.org/admin are forwarded to the webapplication "admin",with the path /admin stripped, e.g. to . In this case, you must:

    • First, configure a router named admin with a rule matching at least the path prefix with the PathPrefix keyword,
    • Then, define a middleware of type stripprefix, which remove the prefix /admin, associated to the router admin.

    Strip Path Prefix When Forwarding to Backend

    v1

    1. labels:
    2. - "traefik.frontend.rule=Host:company.org;PathPrefixStrip:/admin"

    1. apiVersion: networking.k8s.io/v1beta1
    2. kind: Ingress
    3. metadata:
    4. name: traefik
    5. annotations:
    6. kubernetes.io/ingress.class: traefik
    7. traefik.ingress.kubernetes.io/rule-type: PathPrefixStrip
    8. spec:
    9. rules:
    10. - host: company.org
    11. http:
    12. paths:
    13. - path: /admin
    14. backend:
    15. serviceName: admin-svc
    16. servicePort: admin

    1. [frontends.admin]
    2. [frontends.admin.routes.admin_1]
    3. rule = "Host:company.org;PathPrefixStrip:/admin"

    v2

    1. labels:
    2. - "traefik.http.routers.admin.rule=Host(`company.org`) && PathPrefix(`/admin`)"
    3. - "traefik.http.routers.admin.middlewares=admin-stripprefix"
    4. - "traefik.http.middlewares.admin-stripprefix.stripprefix.prefixes=/admin"

    1. ---
    2. apiVersion: traefik.containo.us/v1alpha1
    3. kind: IngressRoute
    4. metadata:
    5. name: http-redirect-ingressRoute
    6. namespace: admin-web
    7. spec:
    8. entryPoints:
    9. - web
    10. routes:
    11. - match: Host(`company.org`) && PathPrefix(`/admin`)
    12. kind: Rule
    13. services:
    14. - name: admin-svc
    15. port: admin
    16. middlewares:
    17. - name: admin-stripprefix
    18. ---
    19. kind: Middleware
    20. metadata:
    21. name: admin-stripprefix
    22. spec:
    23. stripPrefix:
    24. prefixes:
    25. - /admin

    1. ## Dynamic configuration
    2. # dynamic-conf.toml
    3. [http.routers.router1]
    4. rule = "Host(`company.org`) && PathPrefix(`/admin`)"
    5. service = "admin-svc"
    6. entrypoints = ["web"]
    7. middlewares = ["admin-stripprefix"]
    8. [http.middlewares]
    9. [http.middlewares.admin-stripprefix.stripPrefix]
    10. prefixes = ["/admin"]
    11. # ...

    1. ## Dynamic Configuration
    2. # dynamic-conf.yml
    3. # As YAML Configuration File
    4. http:
    5. routers:
    6. admin:
    7. service: admin-svc
    8. middlewares:
    9. - "admin-stripprefix"
    10. rule: "Host(`company.org`) && PathPrefix(`/admin`)"
    11. middlewares:
    12. admin-stripprefix:
    13. stripPrefix:
    14. prefixes:
    15. - "/admin"
    16. # ...

    What About Other Path Transformations?

    Instead of removing the path prefix with the , you can also:

    ACME is now a certificate resolver (under a certificatesResolvers section) but remains in the static configuration.

    ACME from provider to a specific Certificate Resolver

    v1

    1. # static configuration
    2. defaultEntryPoints = ["web-secure","web"]
    3. [entryPoints.web]
    4. address = ":80"
    5. [entryPoints.web.redirect]
    6. entryPoint = "webs"
    7. [entryPoints.web-secure]
    8. address = ":443"
    9. [entryPoints.https.tls]
    10. [acme]
    11. email = ""
    12. storage = "acme.json"
    13. entryPoint = "web-secure"
    14. onHostRule = true
    15. [acme.httpChallenge]
    16. entryPoint = "web"

    1. --defaultentrypoints=web-secure,web
    2. --entryPoints=Name:web Address::80 Redirect.EntryPoint:web-secure
    3. --entryPoints=Name:web-secure Address::443 TLS
    4. [email protected]
    5. --acme.storage=acme.json
    6. --acme.entryPoint=web-secure
    7. --acme.httpchallenge.entrypoint=http

    v2

    1. # static configuration
    2. [entryPoints]
    3. [entryPoints.web]
    4. address = ":80"
    5. [entryPoints.web-secure]
    6. [certificatesResolvers.sample.acme]
    7. email = ""
    8. storage = "acme.json"
    9. [certificatesResolvers.sample.acme.httpChallenge]
    10. # used during the challenge
    11. entryPoint = "web"

    1. entryPoints:
    2. web:
    3. address: ":80"
    4. web-secure:
    5. address: ":443"
    6. certificatesResolvers:
    7. sample:
    8. acme:
    9. email: [email protected]
    10. storage: acme.json
    11. httpChallenge:
    12. # used during the challenge
    13. entryPoint: web

    1. --entryPoints.web.address=:80
    2. --entryPoints.websecure.address=:443
    3. .org
    4. --certificatesResolvers.sample.acme.storage=acme.json
    5. --certificatesResolvers.sample.acme.httpChallenge.entryPoint=web

    Traefik Logs

    In the v2, all the remains in the static part but are unified under a log section.There is no more log configuration at the root level.

    Simple log configuration

    v1

    1. # static configuration
    2. logLevel = "DEBUG"
    3. [traefikLog]
    4. filePath = "/path/to/traefik.log"
    5. format = "json"

    1. --logLevel=DEBUG
    2. --traefikLog.filePath=/path/to/traefik.log
    3. --traefikLog.format=json

    v2

    1. # static configuration
    2. [log]
    3. level = "DEBUG"
    4. filePath = "/path/to/log-file.log"
    5. format = "json"

    1. # static configuration
    2. log:
    3. level: DEBUG
    4. filePath: /path/to/log-file.log
    5. format: json

    1. --log.level=DEBUG
    2. --log.filePath=/path/to/traefik.log
    3. --log.format=json

    Tracing

    Traefik v2 retains OpenTracing support. The backend root option from the v1 is gone, you just have to set your .

    Simple Jaeger tracing configuration

    1. --tracing.backend=jaeger
    2. --tracing.servicename=tracing
    3. --tracing.jaeger.localagenthostport=12.0.0.1:6831
    4. --tracing.jaeger.samplingparam=1.0
    5. --tracing.jaeger.samplingserverurl=http://12.0.0.1:5778/sampling
    6. --tracing.jaeger.samplingtype=const

    v2

    1. # static configuration
    2. [tracing]
    3. servicename = "tracing"
    4. [tracing.jaeger]
    5. samplingParam = 1.0
    6. samplingServerURL = "http://12.0.0.1:5778/sampling"
    7. samplingType = "const"
    8. localAgentHostPort = "12.0.0.1:6831"

    1. # static configuration
    2. tracing:
    3. servicename: tracing
    4. jaeger:
    5. samplingParam: 1
    6. samplingServerURL: 'http://12.0.0.1:5778/sampling'
    7. samplingType: const
    8. localAgentHostPort: '12.0.0.1:6831'

    1. --tracing.servicename=tracing
    2. --tracing.jaeger.localagenthostport=12.0.0.1:6831
    3. --tracing.jaeger.samplingparam=1.0
    4. --tracing.jaeger.samplingserverurl=http://12.0.0.1:5778/sampling
    5. --tracing.jaeger.samplingtype=const

    Metrics

    The v2 retains metrics tools and allows metrics to be configured for the entrypoints and/or services.For a basic configuration, the remains the same.

    Simple Prometheus metrics configuration

    v1

    1. # static configuration
    2. [metrics.prometheus]
    3. buckets = [0.1,0.3,1.2,5.0]
    4. entryPoint = "traefik"

    1. --metrics.prometheus.buckets=[0.1,0.3,1.2,5.0]
    2. --metrics.prometheus.entrypoint=traefik

    v2

    1. # static configuration
    2. [metrics.prometheus]
    3. buckets = [0.1,0.3,1.2,5.0]
    4. entryPoint = "metrics"

    1. # static configuration
    2. metrics:
    3. prometheus:
    4. buckets:
    5. - 0.1
    6. - 0.3
    7. - 1.2
    8. - 5
    9. entryPoint: metrics

    1. --metrics.prometheus.buckets=[0.1,0.3,1.2,5.0]
    2. --metrics.prometheus.entrypoint=metrics

    To avoid any source of confusion, there are no more configuration at the root level.Each root item has been moved to a related section or removed.

    From root to dedicated section

    v1

    1. # static configuration
    2. checkNewVersion = false
    3. sendAnonymousUsage = true
    4. logLevel = "DEBUG"
    5. insecureSkipVerify = true
    6. rootCAs = [ "/mycert.cert" ]
    7. maxIdleConnsPerHost = 200
    8. providersThrottleDuration = "2s"
    9. AllowMinWeightZero = true
    10. debug = true
    11. defaultEntryPoints = ["web", "web-secure"]
    12. keepTrailingSlash = false

    1. --checknewversion=false
    2. --sendanonymoususage=true
    3. --loglevel=DEBUG
    4. --insecureskipverify=true
    5. --rootcas=/mycert.cert
    6. --maxidleconnsperhost=200
    7. --providersthrottleduration=2s
    8. --allowminweightzero=true
    9. --debug=true
    10. --defaultentrypoints=web,web-secure
    11. --keeptrailingslash=true

    v2

    1. # static configuration
    2. [global]
    3. checkNewVersion = true
    4. sendAnonymousUsage = true
    5. [log]
    6. level = "DEBUG"
    7. [serversTransport]
    8. insecureSkipVerify = true
    9. rootCAs = [ "/mycert.cert" ]
    10. maxIdleConnsPerHost = 42
    11. [providers]
    12. providersThrottleDuration = 42

    1. # static configuration
    2. global:
    3. checkNewVersion: true
    4. sendAnonymousUsage: true
    5. log:
    6. level: DEBUG
    7. serversTransport:
    8. insecureSkipVerify: true
    9. rootCAs:
    10. - /mycert.cert
    11. maxIdleConnsPerHost: 42
    12. providers:
    13. providersThrottleDuration: 42

    1. --global.checknewversion=true
    2. --global.sendanonymoususage=true
    3. --log.level=DEBUG
    4. --serverstransport.insecureskipverify=true
    5. --serverstransport.rootcas=/mycert.cert
    6. --serverstransport.maxidleconnsperhost=42
    7. --providers.providersthrottleduration=42

    Dashboard

    You need to activate the API to access the .As the dashboard access is now secured by default you can either:

    • define a specific router with the service and one authentication middleware like the following example
    • or use the insecure option of the API

    Dashboard with k8s and dedicated router

    As is not a Kubernetes service, you have to use the file provider or the insecure API option.

    Activate and access the dashboard

    v1

    1. ## static configuration
    2. # traefik.toml
    3. [entryPoints.web-secure]
    4. address = ":443"
    5. [entryPoints.web-secure.tls]
    6. [entryPoints.web-secure.auth]
    7. [entryPoints.web-secure.auth.basic]
    8. users = [
    9. "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"
    10. ]
    11. [api]
    12. entryPoint = "web-secure"

    1. --entryPoints='Name:web-secure Address::443 TLS Auth.Basic.Users:test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/'
    2. --api

    v2

    1. # dynamic configuration
    2. labels:
    3. - "traefik.http.routers.api.rule=Host(`traefik.docker.localhost`)"
    4. - "traefik.http.routers.api.entrypoints=web-secured"
    5. - "[email protected]"
    6. - "traefik.http.routers.api.middlewares=myAuth"
    7. - "traefik.http.routers.api.tls"
    8. - "traefik.http.middlewares.myAuth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/"

    1. ## static configuration
    2. # traefik.yaml
    3. entryPoints:
    4. web-secure:
    5. address: ':443'
    6. api: {}
    7. providers:
    8. file:
    9. directory: /path/to/dynamic/config
    10. ##---------------------##
    11. ## dynamic configuration
    12. # /path/to/dynamic/config/dynamic-conf.yaml
    13. http:
    14. routers:
    15. api:
    16. rule: Host(`traefik.docker.localhost`)
    17. entrypoints:
    18. - web-secure
    19. service:
    20. middlewares:
    21. - myAuth
    22. tls: {}
    23. middlewares:
    24. myAuth:
    25. basicAuth:
    26. users:
    27. - 'test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/'

    Providers

    • Azure Service Fabric
    • BoltDB
    • Consul
    • Consul Catalog
    • Docker
    • DynamoDB
    • ECS
    • Etcd
    • Eureka
    • File
    • Kubernetes Ingress (without annotations)
    • Kubernetes IngressRoute
    • Marathon
    • Mesos
    • Rancher
    • Rest
    • Zookeeper

    Some Tips You Should Know

    • Different sources of static configuration (file, CLI flags, …) cannot be mixed.
    • Now, configuration elements can be referenced between different providers by using the provider namespace notation: @<provider>.For instance, a router named myrouter in a File Provider can refer to a service named defined in Docker Provider with the following notation: .
    • If you have any questions feel free to join our community forum.