ModelOps authentication flows: browser, M2M, serving
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 type | Credential | Gateway authentication | Downstream identity |
|---|---|---|---|
| Browser web app | OIDC proxy session cookie | ExtAuthZ call → OIDC identity provider → JWT RequestAuthentication | email claim → common user identity header |
| Ordinary API M2M | Authorization: Bearer <token> | RequestAuthentication dedicated to ServiceAccount tokens | Token sub claim → common user identity header |
| Model serving M2M | Authorization: Bearer <token> | Ingress gateway JWT + internal-only gateway JWT + predictor sidecar AuthorizationPolicy | Same 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
Authorizationheader 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
emailclaim to the common user identity header. - A RequestAuthentication that validates a ServiceAccount token in
Authorization: Bearer <token>form and maps thesubclaim 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.
Browser authentication flow
Section titled “Browser authentication flow”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.
Ordinary API M2M authentication flow
Section titled “Ordinary API M2M authentication flow”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>.
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.
| Gate | Location | Pass condition | Symptom when it fails |
|---|---|---|---|
| 1-hop JWT | Mesh ingress gateway | Token issuer is registered and signature validation succeeds | Unregistered issuer error or 401 |
| 2-hop JWT | Internal-only gateway | The same issuer is also registered on this gateway | 401 with the predictor internal host realm |
| Predictor authz | Predictor sidecar | Common user identity header matches the owner policy or an additional ALLOW policy | 403 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.
Locating the gate from failure symptoms
Section titled “Locating the gate from failure symptoms”| Symptom | Usually blocked at | What to check |
|---|---|---|
| Browser does not reach the login page | ExtAuthZ delegation or identity provider routing | Login path exclusions, OIDC proxy configuration |
| 403 after login | JWT validation or downstream AuthorizationPolicy | RequestAuthentication, the “JWT required” policy, common user identity header value |
| 401 on API call (issuer not configured) | Ingress gateway RequestAuthentication | Token iss claim, list of registered issuers |
| 401 on serving call with the predictor internal host as realm | Internal-only gateway RequestAuthentication | Issuer list on that gateway |
| 403 access denied on serving call | Predictor sidecar AuthorizationPolicy | Owner-allow policy, backend-only allow policy, header value |
| Dashboard host breaks with 403 | A serving route collides with the dashboard host after VirtualService merge | Confirm 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.