Skip to content

Dex (OIDC identity provider)

Interactive Diagram

새 탭 ↗
ItemValue
Versionv2.45.1 (ghcr.io/dexidp/dex)
Official docsDex documentation
Upstream sourcecommon/dex

Dex is an OpenID Connect (OIDC) identity provider. It can authenticate users directly, or federate an upstream identity source (connectors such as LDAP, SAML, GitHub, Microsoft/AD) in front of it, and it issues standard OIDC tokens. In that sense, Dex is a broker that combines many authentication sources behind a single OIDC interface.

In this repository, Dex is the authority that actually validates user credentials during browser login. oauth2-proxy manages the session, but Dex is the component that issues the identity tokens.

Authentication source: connector vs static password

Section titled “Authentication source: connector vs static password”
  • upstream connector: connects an existing corporate IdP such as LDAP/SAML/OIDC/GitHub so users log in with those accounts (the standard approach for production).
  • static password DB: users are registered directly in Dex’s own DB. For demo purposes this deployment uses enablePasswordDB: true and the static user user@example.com (the password comes from the DEX_USER_PASSWORD env).

The static password option is convenient for local or lab use, but it is not the right long-term pattern for production. The development flow uses a static-password connector; production deployments should use an appropriate upstream identity connector.

  • issuer: http://dex.auth.svc.cluster.local:5556/dex (in-cluster address). It is the token issuer identifier and the reference point for OIDC discovery.
  • storage: kubernetes (Dex state is stored as Kubernetes CRDs). No separate DB is needed.
  • staticClient: one OIDC client is registered, and that client is oauth2-proxy. redirectURIs must be absolute URIs, so it is written as ["https://<dashboard-host>/oauth2/callback"]. The client id/secret are injected through env (OIDC_CLIENT_ID / OIDC_CLIENT_SECRET).

Per the OIDC specification, redirect_uri must be an absolute URI, and Dex rejects a relative path such as /oauth2/callback at client registration time.

Dex runs in the auth namespace and is reached through the Istio gateway for browser authorization, while token exchange uses the internal Service. This makes Dex the login authority for the browser flow while keeping the integration surface standard OIDC.

In Kubeflow gateway authentication, the component that actually decides “who is the user” is Dex. oauth2-proxy handles session management and mediates the flow, but the authority that validates credentials and issues identity tokens is Dex. Without Dex, interactive login does not work.

Kubeflow’s interactive user experience depends on a single sign-in flow that can front many web apps. Dashboard, Notebooks, Pipelines UI, and other browser-based components should not each implement their own authentication stack.

  • User authentication and identity issuance: validates credentials and issues an OIDC id_token (for example, email user@example.com). This email continues downstream as kubeflow-userid and becomes the basis of multi-tenancy identity.
  • Integration point for oauth2-proxy: registers oauth2-proxy as an OIDC client through staticClient. This client registration is what the “oauth2-proxy -> Dex” connection actually is.
  • Single login entry point: multiple Kubeflow web apps do not each run their own IdP; login is unified through one Dex.

One distinction: this role is for interactive (browser) login only. Backend/API calls (M2M) do not go through Dex; the gateway’s RequestAuthentication validates Kubernetes ServiceAccount tokens directly.

Dex supplies OIDC identity proof to oauth2-proxy, which then establishes the browser session consumed by Kubeflow applications. Dex is the component that answers the question, “Who is this user?” Once that answer exists as an OIDC token, oauth2-proxy and Istio can enforce access across the rest of the platform.

The dev overlay is a single line and looks empty, but the full Dex installation actually comes through a three-level nested overlay chain. The thin dev overlay pulls the oauth2-proxy overlay in common, which in turn goes through the istio overlay down to base.

overlays/dev/dex/overlays/oauth2-proxy # dev overlay (resources 한 줄)
-> common/dex/overlays/oauth2-proxy # ConfigMap patch(static user + oauth2-proxy staticClient) + NetworkPolicy
-> common/dex/overlays/istio # VirtualService(/dex/) + Service host replacement
-> common/dex/base # 실제 설치물

Each layer has the following role. base lays down Dex itself, the istio overlay adds /dex/ exposure, and the oauth2-proxy overlay patches the config to fit this deployment.

LayerRole
common/dex/baseauth namespace, Deployment (v2.45.1), Service (5556), RBAC, storage CRD, static password Secret, dex-oidc-client Secret (OIDC client id/secret)
common/dex/overlays/istioAdds the /dex/ VirtualService, replaces the Service host
common/dex/overlays/oauth2-proxyPatches the ConfigMap with the static user and oauth2-proxy staticClient, adds NetworkPolicy

The client id/secret and static password are generated from the example values in base (secret_params.env, dex-passwords.yaml), so they must be replaced in production.

So while the dev overlay itself is thin, it still results in a full Dex installation with Kubeflow-aware routing and OIDC wiring.

Internal issuer, login through the gateway

Section titled “Internal issuer, login through the gateway”

The issuer is an in-cluster Service address, but for a browser to log in it must reach Dex’s authorization endpoint. That is why Dex is also exposed on the gateway host under /dex/. oauth2-proxy redirects the browser to /dex/auth (the login screen), and does token exchange and key lookup directly against the internal Service address.

The asymmetry of an internal issuer and an external-host redirectURI looks odd at first. The reason is that the two values have different consumers. redirect_uri is a URL the browser follows, so it must be an absolute address that resolves from outside the cluster. The token endpoint (/dex/token) and JWKS (/dex/keys) calls, on the other hand, are back-channel calls that oauth2-proxy and the gateway make directly inside the cluster, so an internal Service address is sufficient. The only endpoint the browser must reach from outside is the authorization endpoint.

The deployment pairs internal issuer endpoints with a gateway-mediated browser login path so the same service serves both OIDC phases safely.

NamespaceResourceNamePurpose
authDeployment + ServicedexOIDC IdP (port 5556)
authConfigMapdexissuer, staticClient, and staticPassword configuration
authSecret(client id/secret, user password)OIDC client credentials, static user password
authDex CRD storage objects(storage=kubernetes)Stores Dex internal state
authVirtualServicedexBound to kubeflow/kubeflow-gateway, routes /dex/ to the Dex service

PlantUML source:

PlantUML Diagram

When oauth2-proxy hands an unauthenticated request to Dex, Dex shows the login screen, validates the credentials, issues a token, and returns it to oauth2-proxy. The full gate flow is covered in the oauth2-proxy post; this section covers only the Dex side.

Seen from Dex, the interactive flow is:

  1. oauth2-proxy redirects the user to Dex;
  2. the user submits credentials to Dex;
  3. Dex validates them against the configured connector or password database;
  4. Dex returns an authorization code;
  5. oauth2-proxy exchanges that code for tokens and establishes the session.

Dex therefore does not hold the user session itself. It proves identity and issues tokens; oauth2-proxy turns that into a usable web session for the gateway.

PlantUML source:

PlantUML Diagram
  • Prerequisites: istio (the gateway and VirtualService that expose Dex on /dex/). Dex itself runs in its own namespace (auth).
  • Downstream (depends on Dex): oauth2-proxy (the target of login delegation) and every interactive web app authenticated through it.

During browser login, oauth2-proxy sends the user to Dex (/dex/auth), and Dex validates the credentials and issues a token. oauth2-proxy creates the session from that token. The M2M (API) path does not use this interaction.

The browser authorization request and the internal token exchange are deliberately separate paths of the same OIDC login flow. When a browser user is not logged in, oauth2-proxy delegates identity proof to Dex and then resumes control once Dex has issued tokens.

  • In production, do not use the static password as is. Connect a real corporate IdP through an upstream connector (LDAP/SAML/OIDC and so on), or at minimum replace the static user’s email/password with an overlay patch (no plaintext).
  • Because the issuer is an in-cluster Service address, clients that call Dex discovery directly from outside are expected to go through the gateway /dex/ path.
  • overlay: overlays/dev/dex/overlays/oauth2-proxy
  • Related posts: