Skip to content

Kubernetes config for Traefik #482

@paulhanssen

Description

@paulhanssen

Hello (again),

How does one get the correct redirect_uri for tinyauth and traefik in Kubernetes?

I have the following Traefik middlware for Tinyauth v4.1.0 (that shows in the Traefik dashboard):

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: tinyauth
  namespace: tinyauth
spec:
  forwardAuth:
    address: https://tinyauth.example.com/api/auth/traefik
    trustForwardHeader: true

I then configure the ingress annotations for whoami, setting up traefik and the middleware:

  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
    traefik.ingress.kubernetes.io/router.middlewares: tinyauth-tinyauth@kubernetescrd

(traefik is configured to accept cross-namespace middlewares)

Then I add the following common labels in my whoami config (helm):

  tinyauth.apps.whoami.users.allow: xyzuser
  tinyauth.apps.whoami.config.domain: whoami.example.com

This shows as a label on the service:

$ kubectl get svc --show-labels -n whoami

NAME     TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE   LABELS
whoami   ClusterIP   10.4x.yy.zzz   <none>        80/TCP    8d    app.kubernetes.io/component=whoami,app.kubernetes.io/instance=whoami,app.kubernetes.io/managed-by=Helm,app.kubernetes.io/name=whoami,app.kubernetes.io/version=1.11.0,helm.sh/chart=whoami-6.0.0,tinyauth.apps.whoami.config.domain=whoami.example.com,tinyauth.apps.whoami.users.allow=xyzuser

But then when I point my browser to whoami.example.com, I get a re-directed login of

https://tinyauth.example.com//login?redirect_uri=https%3A%2F%2Ftinyauth.example.com

Please, can you tell me what I'm missing?

I feel I'm close, just missing that last bit about how to get the re-direct and tinyauth labels working. Any help would be appreciated :) Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions