Configuration

June 15, 2021 ยท View on GitHub

An example configuration is available here

Configuration options

NameRequiredContextDescription
nameyesclusterInternal id of cluster
short_descriptionyesclusterShort description of cluster
descriptionyesclusterExtended description of cluster
client_secretyesclusterOAuth2 client-secret (shared between dex-k8s-auth and dex)
client_idyesclusterOAuth2 client-id public identifier (shared between dex-k8s-auth and dex)
connector_idnoclusterDex connector ID to use by default omitting other available connectors
issueryesclusterDex issuer url
redirect_uriyesclusterRedirect uri called by dex (defines a callback on dex-k8s-auth)
k8s_master_urinoclusterKubernetes api-server endpoint (used in kubeconfig)
k8s_ca_urinoclusterA url pointing to the CA for generating 'certificate-authority' option in kubeconfig
k8s_ca_pemnoclusterThe CA for your k8s server (used in generating instructions)
k8s_ca_pem_base64_encodednoclusterThe Base64 encoded CA for your k8s server (used in generating instructions)
k8s_ca_pem_filenoclusterThe CA file for your k8s server (used in generating instructions)
scopesnoclusterA list OpenID scopes to request
tls_certnorootPath to TLS cert if SSL enabled
tls_keynorootPath to TLS key if SSL enabled
idp_ca_urinorootA url pointing to the CA for generating 'idp-certificate-authority' in the kubeconfig
idp_ca_pemnorootThe CA for generating 'idp-certificate-authority' in the kubeconfig
idp_ca_pem_filenorootThe CA for generating 'idp-certificate-authority' in the kubeconfig - load from file
trusted_root_canorootA list of trusted-root CA's to be loaded by dex-k8s-auth at runtime
trusted_root_ca_filenorootA list of trusted-root CA's to be loaded by dex-k8s-auth at runtime - load from file
listenyesrootThe listen address/port
web_path_prefixnorootA path-prefix to serve dex-k8s-auth at (defaults to '/')
kubectl_versionnorootA kubectl-version string that is used to provided a download path
logo_urinorootA url pointing to a logo image that is displayed in the header
debugnorootEnable more debug by setting to true

Environment Variable Support

Environment variables can be included in the configuration. This enables you to pass in dynamic variables or secrets without having to hardcode them.

clusters:
  - name: example-cluster
    short_description: "Example Cluster"
    description: "Example Cluster Long Description..."
    client_secret: ${CLIENT_SECRET_EXAMPLE_CLUSTER}

In this example, ${CLIENT_SECRET_EXAMPLE_CLUSTER} is substituted at runtime. Must be enclosed by ${...}

Web Path Prefix

A common practise is configure dex-k8s-authenticator to serve requests under a specific path prefix, such as https://mycompany.example.com/dex-auth

You can achieve this by configuring the web_path_prefix. In most cases you will need to adjust the Ingress path setting to match.

In addition to this, you need to update the redirect_uri value.

clusters:
  - name: example-cluster
    short_description: "Example Cluster"
    description: "Example Cluster Long Description..."
    redirect_uri: http://127.0.0.1:5555/dex-auth/callback/example-cluster
    client_secret: ...
    client_id: example-cluster-client-id
    issuer:  http://127.0.0.1:5556
    k8s_master_uri: https://your-k8s-master.cluster
    scopes:
      - email
      - profile
      - openid

# A path-prefix from which to serve requests and assets
web_path_prefix: /dex-auth

Don't forget to update the Dex staticClients.redirectURIs value to include the prefix as well.

Helm

The dex-k8s-authenticator helm charts support this via the dexK8sAuthenticator.web_path_prefix and ingress.path options. You typically set these to the same value.

Note that the health-checks are configured automatically.