Traefik Setup

Last Edit: 2023.11.24

Overview

Setup Traefik, with TrueCharts, and configure ingress on TrueNAS Scale.

Assumptions

Entrypoint

Traefik will be the primary entrypoint for application traffic to the server. Prepare the server before installing Traefik depending on the load balancer employed on the system: integrated or MetalLB.

Integrated Load Balancer

If using the integrated load balancer, the Traefik application will likely share an IP address with the TrueNAS server. The TrueNAS dashboard is running on port 80 and 443 by default. Change the ports TrueNAS binds to so Traefik can utilize port 80 and 443, for a seamless HTTP and HTTPS experience.

Navigate to System Settings - General and open the settings for GUI.

Modify the web interface configuration as required. Choose new port numbers for the web interface.

SettingValueDescription
Web Interface HTTP Port13080Choose an HTTP port.
Web Interface HTTPS Port13443Choose an HTTPS port.

Save the configuration and begin the confirmation process. The changes must be manually confirmed by accessing the server from the newly configured port.

Using the system IP address or configured domain, connect to TrueNAS using the configured port.

https://172.16.13.13:13443/
https://truenas.example.com:13443/

Once port 80 and 443 have been released from TrueNAS, continue to installing Traefik.

MetalLB

If setup and using MetalLB, Traefik should be configured to have a different IP address on the load balancer. Pick an IP address to use on the network and use it in the LoadBalancer IP configuration for the web entrypoints in Traefik. With this configuration, both TrueNAS and Traefik can use ports 80 and 443 on their own IP address. For example, 192.168.1.44 will be used.

Install Traefik

Navigate to the Applications page in the TrueNAS Scale dashboard, Apps on the main navigation.

Switch to the Available Applications tab in the Applications page.

Using the search tool, find the traefik application. Verify Traefik is from the TrueCharts catalog and is on the Enterprise train.

Select Install to begin configuration and installation of the application. Configuration options not mentioned in this section can be left as default.

Application Name

SettingValueDescription
Application NametraefikName for the application.
Version Number#.#.#Version to use, latest by default.

App Configuration

SettingValueDescription
Expert ModefalseEnable if needed.
Log LevelErrorsHow detailed logging should be.
General Log FormatCommon Log FormatFormat for creating logs.
Access LogsfalseEnable to use access logging.

Networking and Services

SettingValueDescription
Main Service
Service TypeClusterIP (Do Not Expose Ports)Traefik service dashboard, use ClusterIP so it can be accessed via ingress.
Port9000Default port.
TCP Service
Service TypeLoad Balancer (Expose Ports)TCP web entrypoint service for Traefik.
LoadBalancer IP192.168.1.44Only use with MetalLB, use a chosen IP address for the Traefik application to be exposed on. Leave blank if using integrated load balancer.
Web Entrypoint Port80HTTP port.
Web Secure Entrypoint Port443HTTPS port.

Storage and Persistence

SettingValueDescription
App Config Storage
Type of StoragePVCUse PersistentVolume.
Read OnlyfalseKeep disabled, write permission required.
Size quotum of Storage16GiMaximum disk usage - can never be decreased, only increased.

Ingress

This ingress configuration only relates to the administrative dashboard of Traefik. Enable ingress to access the Traefik dashboard, but note that it will lack any login protection until an authentication provider is setup.

SettingValueDescription
Main Ingress
Enable IngresstrueToggle ingress state.
HostNametraefik.example.comIngress host on the server domain.
Path/Root path.
Path TypePrefixPrefix path.
Cert-Manager clusterIssuercertCluster issuer for automatic certificates.
Traefik MiddlewaresLeave empty until authentication provider is setup.

Once an authentication provider has been setup, configure the middleware for the ingress.

Save

Verify you have checked the TrueCharts documentation for Traefik and Save. The application will begin installation and deploy. Navigate to the Installed Applications tab to monitor the status.

Traefik Dashboard

When Traefik enters the ACTIVE state, navigate to the dashboard in a browser window.

https://traefik.example.com/dashboard/

Traefik network dashboard.

References

1 2 3