mintel / dex-k8s-authenticator

A Kubernetes Dex Client Authenticator
MIT License
374 stars 146 forks source link

Failed to query provider "https://dex.example.org/": 400 Bad Request: Client sent an HTTP request to an HTTPS server. #165

Open oz123 opened 3 years ago

oz123 commented 3 years ago

Not sure if this is a real issue, this happens when I configure Dex to use TLS and also configure an NGINX ingress with TLS In dex.yaml

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-production"
  tls:
  - secretName: dex-tls
    hosts:
      - https://dex.example.org/
  hosts:
  - https://dex.example.org/
...
web:
    https: 0.0.0.0:5556
    tlsCert: /etc/dex/tls/tls.crt
    tlsKey: /etc/dex/tls/tls.key

If I enable TLS and remove TLS from the ingress e.g:

  ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: "nginx"
    cert-manager.io/cluster-issuer: "letsencrypt-production"
  #tls:
  # - secretName: dex-tls
  #   hosts:
  #     - dex.example.org
  hosts:
  - dex.example.org

I get the following error:

k logs -n dex dex-k8s-authenticator-1616507655-7859889667-q4wkf 
2021/03/23 14:30:48 Using config file: /app/config.yaml
2021/03/23 14:30:48 Creating new provider https://dex.example.org/
2021/03/23 14:30:48 Failed to query provider "https://dex.example.org/": Get https://dex.example.org/.well-known/openid-configuration: remote error: tls: internal error

I had success with using lngress + Let's encrypt certificates for both dex and dex-k8s-authenitcator.