2 min read | by Jordi Prats
If you want to redirect all your HTTP requests to HTTPS, we can configure Traefik to do it for all the Ingress object we have configured
To globally configure Traefik we'll need to configure the HTTP to HTTPS rule on it's helm chart by adding ports.web.redirectTo=websecure, the values file will look as follows:
(...)
ports:
web:
redirectTo: websecure
websecure:
tls:
enabled: true
If we are using a HelmChart object, it would look as follows:
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: traefik
namespace: kube-system
spec:
chart: https://%{KUBERNETES_API}%/static/charts/traefik-10.3.001.tgz
set:
global.systemDefaultRegistry: ""
valuesContent: |-
rbac:
enabled: true
ports:
web:
redirectTo: websecure
websecure:
tls:
enabled: true
podAnnotations:
prometheus.io/port: "8082"
prometheus.io/scrape: "true"
providers:
kubernetesIngress:
publishedService:
enabled: true
priorityClassName: "system-cluster-critical"
image:
name: "rancher/mirrored-library-traefik"
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
Posted on 28/12/2021