2022-04-15 13:44:08 +00:00
---
title: "Traefik Installation Documentation"
description: "There are several flavors to choose from when installing Traefik Proxy. Get started with Traefik Proxy, and read the technical documentation."
---
2019-07-19 07:24:04 +00:00
# Install Traefik
You can install Traefik with the following flavors:
* [Use the official Docker image ](./#use-the-official-docker-image )
2020-03-11 17:28:05 +00:00
* [Use the Helm Chart ](./#use-the-helm-chart )
2019-07-19 07:24:04 +00:00
* [Use the binary distribution ](./#use-the-binary-distribution )
* [Compile your binary from the sources ](./#compile-your-binary-from-the-sources )
## Use the Official Docker Image
2020-10-08 08:38:05 +00:00
Choose one of the [official Docker images ](https://hub.docker.com/_/traefik ) and run it with one sample configuration file:
2022-10-03 13:43:04 +00:00
* [YAML ](https://raw.githubusercontent.com/traefik/traefik/v2.9/traefik.sample.yml )
* [TOML ](https://raw.githubusercontent.com/traefik/traefik/v2.9/traefik.sample.toml )
2019-07-19 07:24:04 +00:00
2019-09-23 12:32:04 +00:00
```bash
2019-07-19 07:24:04 +00:00
docker run -d -p 8080:8080 -p 80:80 \
2022-12-05 15:58:04 +00:00
-v $PWD/traefik.yml:/etc/traefik/traefik.yml traefik:v3.0
2019-07-19 07:24:04 +00:00
```
For more details, go to the [Docker provider documentation ](../providers/docker.md )
!!! tip
* Prefer a fixed version than the latest that could be an unexpected version.
2022-12-05 15:58:04 +00:00
ex: `traefik:v3.0`
2019-09-23 12:32:04 +00:00
* Docker images are based from the [Alpine Linux Official image ](https://hub.docker.com/_/alpine ).
2020-02-03 16:18:05 +00:00
* Any orchestrator using docker images can fetch the official Traefik docker image.
2019-07-19 07:24:04 +00:00
2019-11-27 15:02:05 +00:00
## Use the Helm Chart
2020-03-11 17:28:05 +00:00
!!! warning
2021-06-18 22:08:08 +00:00
The Traefik Chart from
2020-09-23 08:20:04 +00:00
[Helm's default charts repository ](https://github.com/helm/charts/tree/master/stable/traefik ) is still using [Traefik v1.7 ](https://doc.traefik.io/traefik/v1.7 ).
2019-11-27 15:02:05 +00:00
2020-09-16 13:46:04 +00:00
Traefik can be installed in Kubernetes using the Helm chart from < https: / / github . com / traefik / traefik-helm-chart > .
2019-11-27 15:02:05 +00:00
Ensure that the following requirements are met:
2022-12-01 09:10:05 +00:00
* Kubernetes 1.16+
* Helm version 3.9+ is [installed ](https://helm.sh/docs/intro/install/ )
2020-03-11 17:28:05 +00:00
2022-12-01 09:10:05 +00:00
Add Traefik Labs chart repository to Helm:
2020-03-11 17:28:05 +00:00
```bash
2022-11-14 15:04:16 +00:00
helm repo add traefik https://traefik.github.io/charts
2020-03-11 17:28:05 +00:00
```
2019-11-27 15:02:05 +00:00
2020-03-11 17:28:05 +00:00
You can update the chart repository by running:
2019-11-27 15:02:05 +00:00
```bash
2020-03-11 17:28:05 +00:00
helm repo update
2019-11-27 15:02:05 +00:00
```
And install it with the `helm` command line:
```bash
2020-03-11 17:28:05 +00:00
helm install traefik traefik/traefik
2019-11-27 15:02:05 +00:00
```
!!! tip "Helm Features"
2021-06-18 22:08:08 +00:00
2020-03-11 17:28:05 +00:00
All [Helm features ](https://helm.sh/docs/intro/using_helm/ ) are supported.
2022-12-01 09:10:05 +00:00
Examples are provided [here ](https://github.com/traefik/traefik-helm-chart/blob/master/EXAMPLES.md ).
2019-11-27 15:02:05 +00:00
For instance, installing the chart in a dedicated namespace:
```bash tab="Install in a Dedicated Namespace"
2020-03-11 17:28:05 +00:00
kubectl create ns traefik-v2
2019-11-27 15:02:05 +00:00
# Install in the namespace "traefik-v2"
helm install --namespace=traefik-v2 \
2020-03-11 17:28:05 +00:00
traefik traefik/traefik
2019-11-27 15:02:05 +00:00
```
??? example "Installing with Custom Values"
2021-06-18 22:08:08 +00:00
2019-11-27 15:02:05 +00:00
You can customize the installation by specifying custom values,
2020-03-11 17:28:05 +00:00
as with [any helm chart ](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing ).
2019-11-27 15:02:05 +00:00
{: #helm -custom-values }
2021-06-18 22:08:08 +00:00
2022-12-01 09:10:05 +00:00
All parameters are documented in the default [`values.yaml` ](https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml ).
2021-06-18 22:08:08 +00:00
2020-04-29 15:32:05 +00:00
You can also set Traefik command line flags using `additionalArguments` .
2019-11-27 15:02:05 +00:00
Example of installation with logging set to `DEBUG` :
2021-06-18 22:08:08 +00:00
2019-11-27 15:02:05 +00:00
```bash tab="Using Helm CLI"
helm install --namespace=traefik-v2 \
2020-05-18 15:20:04 +00:00
--set="additionalArguments={--log.level=DEBUG}" \
2020-03-11 17:28:05 +00:00
traefik traefik/traefik
2019-11-27 15:02:05 +00:00
```
2021-06-18 22:08:08 +00:00
2019-11-27 15:02:05 +00:00
```yml tab="With a custom values file"
# File custom-values.yml
2020-03-11 17:28:05 +00:00
## Install with "helm install --values=./custom-values.yml traefik traefik/traefik
2020-04-29 15:32:05 +00:00
additionalArguments:
- "--log.level=DEBUG"
2019-11-27 15:02:05 +00:00
```
2021-06-18 22:08:08 +00:00
2020-04-29 15:32:05 +00:00
### Exposing the Traefik dashboard
This HelmChart does not expose the Traefik dashboard by default, for security concerns.
Thus, there are multiple ways to expose the dashboard.
2021-10-08 09:52:05 +00:00
For instance, the dashboard access could be achieved through a port-forward:
2020-04-29 15:32:05 +00:00
```shell
kubectl port-forward $(kubectl get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000
```
2021-10-08 09:52:05 +00:00
It can then be reached at: `http://127.0.0.1:9000/dashboard/`
2020-04-29 15:32:05 +00:00
Another way would be to apply your own configuration, for instance,
by defining and applying an IngressRoute CRD (`kubectl apply -f dashboard.yaml`):
```yaml
# dashboard.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: dashboard
spec:
entryPoints:
- web
routes:
- match: Host(`traefik.localhost`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
kind: Rule
services:
- name: api@internal
kind: TraefikService
```
2019-11-27 15:02:05 +00:00
2019-07-19 07:24:04 +00:00
## Use the Binary Distribution
2020-09-16 13:46:04 +00:00
Grab the latest binary from the [releases ](https://github.com/traefik/traefik/releases ) page.
2019-07-19 07:24:04 +00:00
2019-09-23 12:32:04 +00:00
??? info "Check the integrity of the downloaded file"
2019-07-19 07:24:04 +00:00
```bash tab="Linux"
# Compare this value to the one found in traefik-${traefik_version}_checksums.txt
sha256sum ./traefik_${traefik_version}_linux_${arch}.tar.gz
```
```bash tab="macOS"
# Compare this value to the one found in traefik-${traefik_version}_checksums.txt
shasum -a256 ./traefik_${traefik_version}_darwin_amd64.tar.gz
```
```powershell tab="Windows PowerShell"
# Compare this value to the one found in traefik-${traefik_version}_checksums.txt
Get-FileHash ./traefik_${traefik_version}_windows_${arch}.zip -Algorithm SHA256
```
2019-09-23 12:32:04 +00:00
??? info "Extract the downloaded archive"
2019-07-19 07:24:04 +00:00
```bash tab="Linux"
tar -zxvf traefik_${traefik_version}_linux_${arch}.tar.gz
```
```bash tab="macOS"
tar -zxvf ./traefik_${traefik_version}_darwin_amd64.tar.gz
```
```powershell tab="Windows PowerShell"
Expand-Archive traefik_${traefik_version}_windows_${arch}.zip
```
And run it:
```bash
./traefik --help
```
## Compile your Binary from the Sources
All the details are available in the [Contributing Guide ](../contributing/building-testing.md )
2022-06-27 09:08:08 +00:00
2022-09-09 15:17:53 +00:00
{!traefik-for-business-applications.md!}