Kubernetes

This setup guide is for making Kubernetes service account tokens verifiable by external platforms. You set the cluster's issuer to your oidc.pub URL, then publish the discovery document and JWKS through oidc.pub so cloud IAM can validate those tokens.

Kubernetes: Service Account Issuer Discovery

Prerequisites

  • A Kubernetes cluster with ServiceAccountTokenVolumeProjection enabled (default since 1.20)
  • An oidc.pub service (e.g. k8s-prod.oidc.pub)
  • Admin access to the cluster's API server configuration

Step 1: Configure the API server issuer

Set the service account issuer to your oidc.pub subdomain. This must be done before uploading the configuration so that service account tokens carry the correct iss claim. Select your distribution below.

Edit the ClusterConfiguration to set the issuer in the API server extra args. If the cluster is already running, update /etc/kubernetes/manifests/kube-apiserver.yaml directly — the kubelet will restart the API server automatically.

# ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
apiServer:
  extraArgs:
    service-account-issuer: https://k8s-prod.oidc.pub
    service-account-key-file: /etc/kubernetes/pki/sa.pub
    service-account-signing-key-file: /etc/kubernetes/pki/sa.key

For existing clusters, you can also edit the flags directly in the API server static pod manifest at /etc/kubernetes/manifests/kube-apiserver.yaml.

kubeadm init configuration reference

Step 2: Sync OIDC config to oidc.pub

Kubernetes exposes its OIDC discovery document and JWKS at well-known paths on the API server. You can sync these to oidc.pub manually or run the sync worker to keep them up to date automatically.

Run the sync worker directly in your cluster. It fetches the OIDC config from the API server and pushes it to oidc.pub on a regular interval. Obtain an API key from the oidc.pub dashboard under your service settings.

kubectl run oidcpub-sync \
  --namespace=kube-system \
  --image=registry.gitlab.com/oidc.pub/cli:latest-sync \
  --env="OIDCPUB_SERVICE_ID=<your-service-subdomain>" \
  --env="OIDCPUB_API_KEY=<your-api-key>" \
  --env="SYNC_INTERVAL=300"

The worker syncs on startup and then every SYNC_INTERVAL seconds (default 300). It discovers the API server address and credentials from the in-cluster service account automatically.

Step 3: Verify

Within 60 seconds, your OIDC discovery endpoint is publicly reachable.

curl https://k8s-prod.oidc.pub/.well-known/openid-configuration | jq .
curl https://k8s-prod.oidc.pub/.well-known/jwks.json | jq .

Next steps

  • Sync Worker — configuration reference, authentication options, and one-shot mode
  • Key Rotation — how OIDC providers rotate signing keys and what it means for your sync interval
  • Check out one of the integration guides, for example the AWS Integration Guide — a concrete relying-party setup for identity published through oidc.pub