Skip to content

ModelOps authentication flows: browser, M2M, serving

Interactive Diagram

새 탭 ↗

This platform has a single external entrypoint. TLS terminates at the ingress controller, and the request is forwarded to the mesh ingress gateway as plain HTTP. From there the authentication path splits into three branches depending on whether the request carries an Authorization header.

Request typeCredentialGateway authenticationDownstream identity
Browser web appOIDC proxy session cookieExtAuthZ call → OIDC identity provider → JWT RequestAuthenticationemail claim → common user identity header
Ordinary API M2MAuthorization: Bearer <token>RequestAuthentication dedicated to ServiceAccount tokensToken sub claim → common user identity header
Model serving M2MAuthorization: Bearer <token>Ingress gateway JWT + internal-only gateway JWT + predictor sidecar AuthorizationPolicySame header, but authorized once more in front of the predictor

Two points matter. Browser authentication and API authentication traverse the same gateway but use different login mechanisms, and whichever path a request enters through, the identity that downstream ultimately sees converges on a single common user identity header.

Authentication machinery attached to the gateway

Section titled “Authentication machinery attached to the gateway”

The mesh ingress gateway carries resources that handle interactive authentication and M2M authentication together.

  • An AuthorizationPolicy that delegates requests without an Authorization header to the OIDC proxy’s ExtAuthZ, the login-related paths themselves are excluded from this delegation.
  • A RequestAuthentication that validates the JWT injected by the OIDC proxy and maps the email claim to the common user identity header.
  • A RequestAuthentication that validates a ServiceAccount token in Authorization: Bearer <token> form and maps the sub claim to the same header.
  • An AuthorizationPolicy that rejects requests without a validated JWT principal, again excluding the login paths.
  • A separate workload that exposes the JWKS the mesh needs in order to validate Kubernetes ServiceAccount tokens.

When there is no Authorization header, the OIDC proxy takes charge of the login flow. When the header is present, the OIDC proxy is skipped and RequestAuthentication validates the token directly. Both paths must produce a validated principal to pass the final “JWT required” policy.

PlantUML Diagram

At first there is no Authorization header, so the AuthorizationPolicy delegates the request to the OIDC proxy. Without a session cookie, the OIDC proxy redirects the user to the identity provider’s login page. The identity provider redirects the browser to the OIDC proxy callback, and the OIDC proxy exchanges the authorization code delivered by the browser for tokens over the back channel. It then creates a session cookie and, from then on, injects a validated JWT as the Authorization header. The gateway’s RequestAuthentication validates that JWT and turns the email claim into the common user identity header.

In this structure the identity provider is the authority for interactive user authentication, and the OIDC proxy is the session manager and ExtAuthZ responder. It does not proxy traffic to the app directly. Because the OIDC proxy hands a validated JWT to the gateway, browser requests ultimately pass the same JWT validation policy as M2M requests.

When a backend or CI calls the API, browser redirects are not usable. This platform presents a Kubernetes ServiceAccount token dedicated to the platform backend as Authorization: Bearer <token>.

PlantUML Diagram

The gateway validates the issuer and signature with the RequestAuthentication dedicated to ServiceAccount tokens, and maps the sub claim to the common user identity header. This RequestAuthentication is registered to trust several Kubernetes ServiceAccount token issuers at once.

  • The default cluster-internal issuer for bound/projected tokens
  • An alternative issuer used by some Kubernetes configurations
  • The legacy Secret-based token issuer that has no expiry

Legacy tokens are convenient as long-lived backend credentials, but trusting this issuer means every legacy ServiceAccount token in the cluster can be recognized as a valid identity at the gateway. Actual access scope therefore has to be constrained by downstream RBAC, the common user identity header, and tenant namespace permissions.

Model serving M2M authentication flow: a triple gate

Section titled “Model serving M2M authentication flow: a triple gate”

Serving requests pass one more gate than ordinary API M2M calls. External requests arrive on a serving-dedicated host, and the serving routing resource rewrites the request authority to the predictor’s internal host before passing it through an internal-only gateway once more. The token is therefore validated once at the ingress gateway and once again at the internal-only gateway. Finally, the predictor sidecar’s AuthorizationPolicy must allow the caller.

PlantUML Diagram
GateLocationPass conditionSymptom when it fails
1-hop JWTMesh ingress gatewayToken issuer is registered and signature validation succeedsUnregistered issuer error or 401
2-hop JWTInternal-only gatewayThe same issuer is also registered on this gateway401 with the predictor internal host realm
Predictor authzPredictor sidecarCommon user identity header matches the owner policy or an additional ALLOW policy403 access denied

The owner-allow policy that the tenant controller generates automatically only permits the tenant owner’s email. When the platform backend calls as M2M, its identity has the form system:serviceaccount:<tenant-namespace>:<platform-backend-sa>, so it does not match the owner policy. This deployment adds a separate AuthorizationPolicy in the tenant namespace dedicated to platform backend serving calls, allowing backend calls only for the predictor component.

SymptomUsually blocked atWhat to check
Browser does not reach the login pageExtAuthZ delegation or identity provider routingLogin path exclusions, OIDC proxy configuration
403 after loginJWT validation or downstream AuthorizationPolicyRequestAuthentication, the “JWT required” policy, common user identity header value
401 on API call (issuer not configured)Ingress gateway RequestAuthenticationToken iss claim, list of registered issuers
401 on serving call with the predictor internal host as realmInternal-only gateway RequestAuthenticationIssuer list on that gateway
403 access denied on serving callPredictor sidecar AuthorizationPolicyOwner-allow policy, backend-only allow policy, header value
Dashboard host breaks with 403A serving route collides with the dashboard host after VirtualService mergeConfirm that serving ingress and dashboard hosts do not overlap, then inspect merged route order and destination

Because the three paths eventually converge on the same common user identity header, the fastest way to narrow a problem down is to first ask “at which hop did the header disappear or get mapped incorrectly?” The next article (Multi-tenancy and permission boundaries) covers which namespace and RBAC boundaries this header actually connects to.