Machine Identity
KubernetesEnterprise
Calling Multi-Router from a pod with a projected service account token.
A pod in a Kubernetes cluster authenticates to Multi-Router with a projected service account token: a token the cluster issues to the pod's service account for a chosen audience, and rotates on its own. The cluster is the issuer, and the service account is the subject. This page uses an EKS cluster; GKE and AKS clusters work the same way with their own issuer URLs.
Registering the cluster
The cluster is registered once, as an issuer:
- Find the cluster's OIDC issuer URL. For EKS, it is shown on the cluster's Overview tab as OpenID Connect provider URL.
- Register it as an issuer in Multi-Router, and authorize the organization that owns the routers. See Issuers.
- Copy the issuer's token audience.
Binding the service account
In the organization, add a binding with Caller type Kubernetes service account and the subject system:serviceaccount:payments:api, for the service account api in the namespace payments, with the router it calls. See Bindings.
Configuring the pod
The pod mounts a projected token for the issuer's audience, with a lifetime at or below the issuer's maximum token lifetime:
The application reads the token from the file for each request, since the cluster replaces it before it expires, and sends it as a bearer token:
With one router on the binding, the request needs no model or router name. With the OpenAI SDK, set the base URL and pass the token file's contents as the API key, read again before it expires.
Every service account in a namespace
A binding with Anything under a prefix and the subject system:serviceaccount:payments covers every service account in the payments namespace, so new services there reach the binding's routers without a new binding.