Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Traefik Autumn Edition 2020 [S01E01]

Traefik Autumn Edition 2020 [S01E01]

Traefik Autumn Edition 2020 [S01E01].
Introducing Traefik Proxy 2.3. A Journey into Traefik Plugins via Gitops.

Sergio Maria Matone

October 29, 2020
Tweet

Other Decks in Programming

Transcript

  1. Traefik Autumn Edition S01 - Episodes • S01-E01 - 29

    October 2020 - Sergio Matone • Introducing Traefik Proxy 2.3. A Journey into Traefik Plugins via Gitops • S01-E02 - 16 November 2020 - Kevin Crawley [Traefik Labs] • Kubernetes Ingress Today and Tomorrow • S01-E03 – 17 December 2020 - Brian Christner [The Byte] • Metrics and Prometheus in Traefik Proxy and Pilot
  2. It’s me! • Cloud Architect • NodeJS & Python Dev

    • Traefik Ambassador • Extreme Sports passionate @sw360cab Blog: https://dev.to/sw360cab
  3. Containous ➡ Traefik Labs • As 23 September 2020, Containous

    became officially Traefik Labs • https://traefik.io/blog/traefik-labs-incubating-the-future-of-cloud-native- networking/ • What was formerly known as Traefik was renamed Traefik Proxy • But, how do you pronounce Traefik? • You pronounce Traefik like the regular word Traffic (/ˈtræfɪk/) • Using International Phonetic Alphabet (IPA) • ɪ was replaced with i, which makes the sound more French-friendly
  4. Traefik Proxy • Statistics: • 2 Billion Docker Hub downloads

    • 30k+ Stars on GitHub • 500+ Contributors • Top 10 most popular image from Docker • Use Cases: • Routing & Load balancing • API Gateway • Certificate Management • Kubernetes Ingress
  5. What is Traefik Proxy? It’s an Edge Router • Front

    door to your platform or orchestrated microservices. • Intercepts and route incoming requests. • Routes and load balances requests to internal services according to specific logic. • Resilient to configuration changes. Dynamic configuration watches to orchestrators for new events.
  6. Traefik Proxy Components • Entrypoints: the network entry points listening

    for incoming traffic (port numbers exposed by Traefik). • Providers: existing infrastructure components, whose API are queried to find information about «real» services (IP, health). • Routers: analyze the request (host, path, headers, SSL) in order forward it to the correct service. • Services: abstraction that forward the request to the corresponding «real» services in the infrastructure (load balancing). • Middlewares: may transform the request before they are sent to services (auth, rate limiting, headers, path modifier)
  7. How Traefik Works: Traefik Configuration Traefik configuration is splitted in

    two: • Static (or startup) configuration. The base configuration for Traefik (Entrypoints, Provider [type]). • Dynamic configuration (or Configuration Discovery), which is hot-reloaded anytime there are changes (Provider-dependant: Routers, Services, Middlewares).
  8. More natively from Traefik Proxy • Static configuration is defined

    (mutually exclusive, e.g. you can use only one at the same time), via: • configuration file • In the command-line arguments • As environment variables
  9. More natively from Traefik Proxy Dynamic Configuration is defined according

    to Provider: • Label based (Docker, Rancher, Consul) • CRD or Ingress (Kubernetes) • Key-Value based (etcd, Redis, ZooKeeper) • File based (YAML or TOML) HTTPS & TLS: • Traefik Proxy can act as entry point for TLS connections. • Let's Encrypt (ACME) is supported natively: • Automatic Certificate Generation & Renewal
  10. What’s new in Traefik Proxy 2.3 • Traefik Plugins •

    the ability to add custom middleware functionality easily • Traefik Pilot Integration • SaaS application providing performance metrics, security, and update notifications in real time • Amazon ECS Provider • allows for the dynamic configuration of the provider using labels attached to ECS containers. • Improved Kubernetes IngressClass • New features enabled thanks to improvements to Ingress API released with K8s 1.18
  11. Traefik Plugins – Middleware Plugin Engine Why ? • Many

    open issues on middleware ideas go unimplemented (lack of resources / interest) • Proposed middlewares have been rejected based on maintenance or performance overhead concerns • High demand for custom middlewares as popular issue within Traefik Proxy repository (59 comments, 122 ) How ? • Written in GO • Interpreted and Executed real-time via Yaegi GO Interpreter • Stored and hosted as public Github Repos • Repositories must have ‘traefik-plugin’ topic set • Available through Plugin Marketplace in Traefik Pilot
  12. Traefik Plugins – Middleware Plugin Engine (2) Yaegi - Another

    Elegant Go Interpreter • Allows for the real-time execution of Go code • Exposes a simple interpreter API: New(), Eval(), Use() • Unsafe and Syscall are not used or exported by default • Support for Go 1.14 & 1.15 (ongoing support for latest releases) Developing Plugins • Traefik Proxy includes a development mode where loading plugins via filesystem is permitted • Go must be installed and configured • Plugins must have a valid `.traefik.yml` configuration manifest
  13. Git Operations aka GitOps Principles • use Git as Single

    Source Of Truth. • use Git Operations for building and deployment • hold separete repositories for any application and for infrastructure. GitOps Flavours • Push strategy: based on “push” made in git (GitLab CI, GitHub Actions, Jenkins X). • Pull strategy: which let the infrastructure manage itself performing its own “pull” from the git repository and applying it itself (ArgoCD, Flux).
  14. Let’s play with a Traefik Plugin via GitOps What is

    our goal: • Start from an existing Cluster configured and deployed using Traefik Proxy and a «CNCF» plugin • We can validate and test locally that the configuration is working • Modify an existing plugin • Adding an extra header in all responses • Push modification into git • Wait for our cluster configuration to be reloaded (hopefully!)
  15. Traefik Autumn Edition S01 - Episodes • S01-E01 - 29

    October 2020 - Sergio Matone • Introducing Traefik Proxy 2.3. A Journey into Traefik Plugins via Gitops • S01-E02 - 16 November 2020 - Kevin Crawley [Traefik Labs] • Kubernetes Ingress Today and Tomorrow • S01-E03 – 17 December 2020 - Brian Christner [The Byte] • Metrics and Prometheus in Traefik Proxy and Pilot
  16. Links • Doc Traefik Proxy: • https://doc.traefik.io/traefik/ • Traefik 2.3:

    • https://traefik.io/blog/houston-we-have-plugins-traefik-2-3-announcement/ • Developing Plugins: • https://doc.traefik.io/traefik-pilot/plugins/plugin-dev/ • https://github.com/traefik/plugindemo#dev-mode • Deny IP Plugin: • https://github.com/notsureifkevin/denyip