traefik

by joaquinito2051

Helm chartv1.68.4App 1.7.9

A Traefik based Kubernetes ingress controller with Let's Encrypt support

About this chart

Traefik

Traefik is a modern HTTP reverse proxy and load balancer made to deploy microservices with ease.

Introduction

This chart bootstraps Traefik as a Kubernetes ingress controller with optional support for SSL and Let's Encrypt.

NOTE: Operators will typically wish to install this component into the kube-system namespace where that namespace's default service account will ensure adequate privileges to watch Ingress resources cluster-wide.

Prerequisites

  • Kubernetes 1.4+ with Beta APIs enabled
  • Kubernetes 1.6+ if you want to enable RBAC
  • You are deploying the chart to a cluster with a cloud provider capable of provisioning an external load balancer (e.g. AWS or GKE)
  • You control DNS for the domain(s) you intend to route through Traefik
  • Suggested: PV provisioner support in the underlying infrastructure

A Quick Note on Versioning

Up until version 1.2.1-b of this chart, the semantic version of the chart was kept in-sync with the semantic version of the (default) version of Traefik installed by the chart. A dash and a letter were appended to Traefik's semantic version to indicate incrementally improved versions of the chart itself. For example, chart version 1.2.1-a and 1.2.1-b both provide Traefik 1.2.1, but 1.2.1-b is a chart that is incrementally improved in some way from its immediate predecessor-- 1.2.1-a.

This convention, in practice, suffered from a few problems, not the least of which was that it defied what was permitted by semver 2.0.0. This, in turn, lead to some difficulty in Helm understanding the versions of this chart.

Beginning with version 1.3.0 of this chart, the version references only the revision of the chart itself. The appVersion field in chart.yaml now conveys information regarding the revision of Traefik that the chart provides.

Installing the Chart

To install the chart with the release name my-release:

$ helm install <helm-repo>/traefik --name my-release --namespace kube-system

$ helm install stable/traefik --name my-release --namespace kube-system After installing the chart, create DNS records for applicable domains to direct inbound traffic to the load balancer. You can use the commands below to find the load balancer's IP/hostname:

NOTE: It may take a few minutes for this to become available.

You can watch the status by running:

$ kubectl get svc my-release-traefik --namespace kube-system -w

Once EXTERNAL-IP is no longer <pending>:

$ kubectl describe service my-release-traefik -n kube-system | grep Ingress | awk '{print $3}'

NOTE: If ACME support is enabled, it is only after this step is complete that Traefik will be able to successfully use the ACME protocol to obtain certificates from Let's Encrypt.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Traefik chart and their default values.

ParameterDescriptionDefault
fullnameOverrideOverride the full resource names{release-name}-traefik (or traefik if release-name is traefik)
imageTraefik image nametraefik
imageTagThe version of the official Traefik image to use1.7.9
serviceTypeA valid Kubernetes service typeLoadBalancer
loadBalancerIPAn available static IP you have reserved on your cloud platformNone
startupArgumentsA list of startup arguments which are passed to traefik[]
loadBalancerSourceRangesList of IP CIDRs allowed access to load balancer (if supported)None
externalIPStatic IP for the serviceNone
whiteListSourceRangeEnable IP whitelisting at the entrypoint level.false
externalTrafficPolicySet the externalTrafficPolicy in the Service to either Cluster or LocalCluster
replicasThe number of replicas to run; NOTE: Full Traefik clustering with leader election is not yet supported, which can affect any configured Let's Encrypt setup; see Clustering section1
podDisruptionBudgetPod disruption budget{}
priorityClassNamePod priority class name""
rootCAsRegister Certificates in the RootCA. These certificates will be use for backends calls. NOTE: You can use file path or cert content directly[]
resourcesResource definitions for the generated pods{}
cpuRequestDEPRECATED: use resources instead. Initial share of CPU requested per Traefik podNone
memoryRequestDEPRECATED: use resources instead. Initial share of memory requested per Traefik podNone
cpuLimitDEPRECATED: use resources instead. CPU limit per Traefik podNone
memoryLimitDEPRECATED: use resources instead. Memory limit per Traefik podNone
rbac.enabledWhether to enable RBAC with a specific cluster role and binding for Traefikfalse
deploymentStrategySpecify deployment spec rollout strategy{}
securityContextSecurity context{}
envEnvironment variables for the container{}
nodeSelectorNode labels for pod assignment{}
affinityAffinity settings{}
tolerationsList of node taints to tolerate[]
proxyProtocol.enabledEnable PROXY protocol support.false
proxyProtocol.trustedIPsList of PROXY IPs (CIDR ranges) trusted to accurately convey the end-user IP.[]
forwardedHeaders.enabledEnable support specify trusted clients for forwarded headers.false
forwardedHeaders.trustedIPsList of IPs (CIDR ranges) to be authorized to trust the client forwarded headers (X-Forwarded-*).[]
debug.enabledTurn on/off Traefik's debug mode. Enabling it will override the logLevel to DEBUG and provide /debug/vars endpoint that allows Go runtime stats to be inspected, such as number of Goroutines and memory statsfalse
ssl.enabledWhether to enable HTTPSfalse
ssl.enforcedWhether to redirect HTTP requests to HTTPSfalse
ssl.permanentRedirectWhen ssl.enforced is set, use a permanent (301) redirect instead of a temporary redirect (302)false
ssl.upstreamWhether to skip configuring certs (ie: SSL is terminated by L4 ELB)false
ssl.insecureSkipVerifyWhether to verify certs on SSL connectionsfalse
ssl.tlsMinVersionMinimum TLS version for https entrypointNone
ssl.cipherSuitesSpecify a non-empty list of TLS ciphers to override the default oneNone
ssl.sniStrictEnable strict SNI checking, so that connections cannot be made if a matching certificate does not exist.false
ssl.generateTLSGenerate self sign cert by Helm. If it's true the defaultCert and the defaultKey parameters will be ignored.false
ssl.defaultCNSpecify generated self sign cert CN""
ssl.defaultSANListSpecify generated self sign cert SAN list[]
ssl.defaultIPListSpecify generated self sign cert IP list[]
ssl.defaultCertBase64 encoded default certificateA self-signed certificate
ssl.defaultKeyBase64 encoded private key for the certificate aboveThe private key for the certificate above
ssl.auth.basicBasic auth for all SSL endpoints, see Authentication sectionunset by default; this means basic auth is disabled
acme.enabledWhether to use Let's Encrypt to obtain certificatesfalse

Deploy traefik with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has traefik on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttraefik is pinned at v1.68.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply