Skip to main content

Securing Traefik Ingress

Before You Proceed

Since this guide was written, Pomerium has developed into a first-class proxy service, and provides an integrated Ingress Controller for Kubernetes.

This guide will remain available for those already using Traefik with Pomerium, but we strongly encourage new users to configure Pomerium as the single method of authentication and proxying.

At the end of this guide, you will have an install of a hello-world app proxied by Traefik with authorization policy enforced by Pomerium.

This guide specifically demonstrates using Traefik and Pomerium in the context of a Kubernetes Ingress controller, but the patterns can be utilized anywhere Traefik is deployed.


Traefik can be configured to authorize requests by calling a remote authorization service. Pomerium is compatible with this protocol and can thus be used to protect services behind Traefik. In this configuration, Pomerium does not directly proxy traffic, but only performs authorization decisions on behalf of Traefik. This is useful for integrating into existing load balancer infrastructure.

For more information on using Pomerium as an external authorization endpoint, see forward auth in the Pomerium docs.

How It Works

  • Install Traefik as an Ingress Controller on your Kubernetes cluster
  • Install a standard Pomerium configuration with forwardauth enabled
  • Create middleware to use Pomerium for authorization
  • Install an application with an Ingress resource configured to use the Pomerium authorization middleware
  • Pomerium authenticates users via Identity Provider
  • Traefik queries Pomerium on each request to verify the traffic is authorized
  • Pomerium verifies the traffic against policy, responding to Traefik
  • Traefik proxies the traffic or responds with an error


  • Access to a Kubernetes cluster
  • Helm (already initialized if using helm v2)
  • A copy of the example repo checked out
  • Valid credentials for your OIDC provider
  • (Optional) mkcert to generate locally trusted certificates

This guide is optimized to run on a local kubernetes install in Docker Desktop, however the configuration should be easily portable to minikube or traditional clusters.

If running in minikube or other non-local clusters, you will need to use kubectl port-forward to forward traffic from[80,443] to the Traefik service in Kubernetes, or replace * references with your own domain.

For the purposes of the guide, all resources are installed inside the namespace pomerium.

Certificates (optional)

This demo comes with its own certificates, but they will generate warnings in your browser. You may instead provide your own or use mkcert to generate locally trusted certificates.

After installing mkcert, run the following inside the example repo:

mkcert -install
mkcert '*'

This will install a trusted CA and generate a new wildcard certificate:


To provide your own certificates through another mechanism, please overwrite these files or update the Ingress configurations accordingly.



Update values/pomerium.yaml with your Identity Provider settings, domain names and policy

provider: REPLACEME
clientSecret: REPLACEME

sharedSecret: R0+XRoGVpcoi4PfB8tMlvnrS5XUasO+D1frAEdYcYjs=
cookieSecret: FLPCOQKigK5EQnyXlBhchl5fgzNKqi3ubtvOGt477Dg=
generateTLS: true
- from:
to: http://hello-nginx
- allow:
- domain:
annotations: "true"
secretName: wildcard-tls
enabled: true
internal: true


Helm chart values:

- "--serverstransport.insecureskipverify=true"
- "--entryPoints.websecure.forwardedHeaders.insecure"

Please note forwardedHeaders.insecure must be set on the entrypoint in front of Pomerium proxy if you are routing forward auth requests through Traefik. See docs for more information.


kind: Middleware
name: auth
address: https://pomerium-proxy.pomerium
insecureSkipVerify: true
trustForwardHeader: true

Please note trustForwardHeader: true must be set for the middleware to work correctly. See docs for more information.


Helm chart values:

enabled: true
- name:
path: /

annotations: pomerium-auth@kubernetescrd "true"
- hosts:
secretName: wildcard-tls
type: ClusterIP


Add helm repos

helm repo add bitnami
helm repo add pomerium
helm repo add traefik

Install charts and CRDs

kubectl create namespace pomerium

# Create shared TLS secret
kubectl create secret tls wildcard-tls \
--namespace pomerium \ \

# Install Traefik helm chart
helm upgrade --install --wait \
--namespace pomerium \
traefik traefik/traefik \
--values values/traefik.yaml

# Install Pomerium helm chart
helm upgrade --install --wait \
--namespace pomerium \
pomerium pomerium/pomerium \
--values values/pomerium.yaml

# Create middleware
kubectl --namespace pomerium apply -f crds/middleware.yaml

# Install hello app
helm upgrade --install --wait \
--namespace pomerium \
--version 6.2.1 \
hello bitnami/nginx \
--values values/hello.yaml

After 1-2 minutes, browse to

You should be prompted to log in through your IdP and then granted access to the deployed hello instance.

That's it!

Your hello application is protected by Pomerium.

Here's a run through of the steps in this demo: