Created on 2026-12-03


Kubernetes Hardening L4b: Pod and Workload Identity on Cloud vs Bare Metal with SPIFFE/SPIRE

TL;DR: Static AWS access keys, GCP service account JSON files, and long-lived database passwords stored in Kubernetes Secrets are waiting to be exfiltrated. Every modern workload should authenticate using short-lived, audience-bound cryptographic identities. Start by setting automountServiceAccountToken: false by default and mounting bound projected ServiceAccount tokens only where needed. On managed clouds, use EKS Pod Identity (with ABAC session tags, cluster-scoped trust conditions, and IMDS blocked), GKE Workload Identity Federation (with direct IAM principal bindings), or AKS Microsoft Entra Workload ID. On bare metal, either publish your kube-apiserver OIDC discovery endpoints for external federation or deploy SPIFFE/SPIRE (CNCF Graduated) with TPM 2.0 node attestation (tpm_devid), the csi.spiffe.io CSI driver, and OpenBao (OpenSSF Sandbox) to mint dynamic database and object-storage leases on demand.

The Baseline: Bound Projected ServiceAccount Tokens

Prior to Kubernetes 1.21, every ServiceAccount automatically generated a Secret containing a JWT signed by the cluster's service account key with no expiration date, no audience restriction, and no binding to a specific pod. Worse, Kubernetes mounted that immortal token at /var/run/secrets/kubernetes.io/serviceaccount/token inside every single pod by default. If an attacker exploited a Server-Side Request Forgery (SSRF) or local file inclusion bug in a frontend pod, they walked away with a permanent bearer token for kube-apiserver.

Modern Kubernetes replaces those legacy tokens with Bound ServiceAccount Tokens issued via the TokenRequest API and mounted as projected volumes (while the LegacyServiceAccountTokenCleanUp controller automatically purges unused legacy Secret tokens). Bound tokens enforce three cryptographic properties:

  1. Time-bound: Tokens default to a 1-hour lifetime (expirationSeconds: 3600), and the Kubelet automatically rotates the file on disk when it reaches 80% of its TTL.
  2. Audience-bound (aud): You mint a token specifically for its target consumer (for example, pods.eks.amazonaws.com or https://openbao.bard.sh). If an attacker steals a token minted for https://openbao.bard.sh and replays it against kube-apiserver, the API server rejects it immediately because the aud claim does not match the API server's audience.
  3. Pod-bound: The JWT payload embeds a private kubernetes.io claim recording the exact pod.name, pod.uid, and node.name.

Turn Off automountServiceAccountToken by Default

Most application pods never talk to kube-apiserver. Mounting a token with the default API server audience in those pods hands attackers free cluster reconnaissance (kubectl auth can-i --list) after a container compromise.

Enforce three baseline rules across every namespace:

  1. Patch the default ServiceAccount in every namespace with automountServiceAccountToken: false, and never run workloads under default.
  2. Create one dedicated ServiceAccount per microservice (checkout-api, ledger-worker) with automountServiceAccountToken: false.
  3. When a workload needs to authenticate to a cloud provider or secrets broker, mount an explicit serviceAccountToken projected volume scoped to the target audience and a short expiration (15 to 30 minutes):
apiVersion: v1
kind: ServiceAccount
metadata:
  name: checkout-api
  namespace: payments
automountServiceAccountToken: false
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: checkout-api-pdb
  namespace: payments
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: checkout-api
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-api
  namespace: payments
spec:
  replicas: 3
  revisionHistoryLimit: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      app.kubernetes.io/name: checkout-api
  template:
    metadata:
      labels:
        app.kubernetes.io/name: checkout-api
    spec:
      serviceAccountName: checkout-api
      automountServiceAccountToken: false
      hostUsers: false
      terminationGracePeriodSeconds: 30
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app.kubernetes.io/name: checkout-api
      securityContext:
        runAsNonRoot: true
        runAsUser: 65532
        runAsGroup: 65532
        fsGroup: 65532
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: app
          image: ghcr.io/bard-sh/checkout-api@sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              cpu: "1"
              memory: 256Mi
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8080
            initialDelaySeconds: 3
            periodSeconds: 5
          volumeMounts:
            - name: vault-bound-token
              mountPath: /var/run/secrets/tokens
              readOnly: true
      volumes:
        - name: vault-bound-token
          projected:
            sources:
              - serviceAccountToken:
                  path: openbao-token
                  expirationSeconds: 1800
                  audience: https://openbao.bard.sh

Managed Cloud Workload Identity: EKS, GKE, and AKS

Every major cloud provider now natively exchanges Kubernetes bound projected tokens for short-lived cloud IAM credentials. However, the architecture and operational trade-offs differ significantly across AWS, GCP, and Azure.

Managed Cloud Workload Identity Comparison: EKS Pod Identity, GKE WIF, and AKS Entra Workload ID

AWS EKS: Why EKS Pod Identity Replaces IRSA

AWS introduced IAM Roles for Service Accounts (IRSA) in 2019 by wiring the cluster's public OIDC discovery endpoint into IAM. While IRSA worked, it suffered from painful scaling bottlenecks at multi-cluster scale:

  • Trust policy coupling: Every IAM role had to hardcode the exact OIDC provider ARN (oidc.eks.eu-central-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041E) in its AssumeRoleWithWebIdentity condition. Sharing a role across dozens of ephemeral clusters hit IAM's maximum trust policy character limit and pushed large fleets toward AWS IAM's default quota of 100 OIDC providers per account (adjustable up to 700).
  • Role sprawl: Because IRSA could not dynamically parameterize IAM policies by namespace or pod name, platform teams had to provision hundreds of nearly identical IAM roles via Terraform whenever a new namespace spun up.

EKS Pod Identity eliminates both problems. Instead of relying on an external OIDC provider per cluster, EKS runs the eks-pod-identity-agent DaemonSet on each node listening on link-local address 169.254.170.23:80. When an AWS SDK inside a pod requests credentials, it sends its projected token (aud: pods.eks.amazonaws.com) to the local agent, which calls the EKS Auth API (AssumeRoleForPodIdentity).

Crucially, EKS Pod Identity automatically attaches verified IAM session tags (eks-cluster-arn, eks-cluster-name, kubernetes-namespace, kubernetes-service-account, kubernetes-pod-name) to the assumed STS session. You can now write a single Attribute-Based Access Control (ABAC) IAM role that trusts pods.eks.amazonaws.com and dynamically scopes S3 prefixes or DynamoDB partition keys to the pod's namespace.

Always constrain the role's trust policy with aws:SourceAccount and aws:SourceArn (or aws:RequestTag/eks-cluster-arn with a production cluster ARN pattern for multi-cluster fleets). Without a condition block, any non-production EKS cluster in the same AWS account whose administrator creates a Pod Identity association can assume the production role (a classic confused-deputy escalation):

data "aws_caller_identity" "current" {}

data "aws_iam_policy_document" "pod_identity_trust" {
  statement {
    effect  = "Allow"
    actions = ["sts:AssumeRole", "sts:TagSession"]
    principals {
      type        = "Service"
      identifiers = ["pods.eks.amazonaws.com"]
    }
    # Prevent cross-account and cross-cluster confused-deputy role assumption
    condition {
      test     = "StringEquals"
      variable = "aws:SourceAccount"
      values   = [data.aws_caller_identity.current.account_id]
    }
    condition {
      test     = "ArnEquals"
      variable = "aws:SourceArn"
      values   = [aws_eks_cluster.prod.arn]
    }
  }
}

resource "aws_iam_role" "tenant_s3_writer" {
  name               = "eks-tenant-s3-writer"
  assume_role_policy = data.aws_iam_policy_document.pod_identity_trust.json
}

# ABAC Policy: Pod can only read/write the S3 prefix matching its exact Kubernetes namespace
resource "aws_iam_role_policy" "tenant_s3_abac" {
  name = "namespace-scoped-s3"
  role = aws_iam_role.tenant_s3_writer.id
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect   = "Allow"
        Action   = ["s3:GetObject", "s3:PutObject"]
        Resource = "arn:aws:s3:::bard-prod-tenant-artifacts/$${aws:PrincipalTag/kubernetes-namespace}/*"
      }
    ]
  })
}

resource "aws_eks_pod_identity_association" "checkout" {
  cluster_name    = aws_eks_cluster.prod.name
  namespace       = "payments"
  service_account = "checkout-api"
  role_arn        = aws_iam_role.tenant_s3_writer.arn
}

GCP GKE: Direct Principal Binding Without GSA Sprawl

When Workload Identity Federation for GKE first launched, you had to create a Google Service Account (GSA) in IAM, grant IAM roles to the GSA, grant roles/iam.workloadIdentityUser on the GSA to the Kubernetes ServiceAccount (KSA), and annotate the KSA with iam.gke.io/gcp-service-account. Large organizations quickly hit Google Cloud's per-project GSA quota limits.

Today, GKE supports Direct IAM Principal Binding. You do not need to create a GSA at all. Every GKE cluster automatically registers a project-wide Workload Identity Pool (PROJECT_ID.svc.id.goog), and the node-local gke-metadata-server intercepts requests from pods to 169.254.169.254. You bind GCP IAM permissions directly to the Kubernetes ServiceAccount principal URI:

resource "google_storage_bucket_iam_member" "checkout_bucket_access" {
  bucket = google_storage_bucket.invoices.name
  role   = "roles/storage.objectUser"
  # Direct KSA binding - zero GCP Service Account (GSA) required
  member = "principal://iam.googleapis.com/projects/${data.google_project.current.number}/locations/global/workloadIdentityPools/${var.project_id}.svc.id.goog/subject/ns/payments/sa/checkout-api"
}

Azure AKS: Microsoft Entra Workload ID

On AKS, the legacy aad-pod-identity project (which intercepted IMDS traffic using iptables rules and a privileged Node Managed Identity daemon) is deprecated and retired.

Its replacement, Microsoft Entra Workload ID, uses standard OIDC federation. Enable --enable-oidc-issuer and --enable-workload-identity on the AKS cluster, annotate your Kubernetes ServiceAccount with azure.workload.identity/client-id, and label the pod azure.workload.identity/use: "true". The AKS mutating webhook injects a projected token (aud: api://AzureADTokenExchange), which the Azure Identity SDK exchanges directly against a FederatedIdentityCredential configured on a User-Assigned Managed Identity for subject: system:serviceaccount:payments:checkout-api.

Blocking Cloud IMDS (169.254.169.254): Close the Node Role Escape Hatch

Deploying EKS Pod Identity or AKS Entra Workload ID does not automatically block pods from reaching the EC2 or Azure VM Instance Metadata Service (169.254.169.254 on IPv4 across cloud providers, plus fd00:ec2::254 specifically on AWS EC2 IPv6). If a pod without workload identity sends an HTTP request to http://169.254.169.254/latest/meta-data/iam/security-credentials/, it receives the temporary IAM credentials of the underlying worker node (which typically holds permissions to pull from ECR, attach EBS volumes, or modify ENIs).

Warning: Do not apply a blanket Cilium egressDeny rule for 169.254.169.254/32 on GKE clusters using GKE Workload Identity Federation. On GKE, the node-local gke-metadata-server intercepts pod traffic to 169.254.169.254 in order to serve scoped KSA tokens (and already conceals the underlying Compute Engine node metadata server from workloads). Apply the Cilium egressDeny policy below on EKS, AKS, and bare-metal clusters, and ensure GKE node pools have Workload Identity Federation enabled (--workload-metadata=GKE_METADATA).

Always enforce a two-layer IMDS block on EKS and AKS worker nodes:

  1. Enforce IMDSv2 with http_put_response_hop_limit = 1 on EC2 launch templates. IMDSv2 requires a session-oriented PUT request to mint a token, and setting the IP TTL hop limit to 1 causes the Linux kernel to drop the response before it can traverse the veth router hop into a container network namespace (note: pods running with hostNetwork: true bypass this hop check).
  2. Drop 169.254.169.254/32 (and AWS EC2's fd00:ec2::254/128 on IPv6-enabled EKS clusters) in your CNI. On Cilium (CNCF Graduated), deploy a cluster-wide egressDeny guardrail that no tenant NetworkPolicy can override (omit fd00:ec2::254/128 on AKS or IPv4-only clusters, and verify any infra controllers outside kube-system such as Karpenter already use Pod Identity before enforcing):
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
  name: block-cloud-imds
spec:
  endpointSelector:
    matchExpressions:
      - key: io.kubernetes.pod.namespace
        operator: NotIn
        values: ["kube-system"]
  enableDefaultDeny:
    ingress: false
    egress: false
  egressDeny:
    - toCIDR:
        - 169.254.169.254/32
        # AWS EC2 IPv6 IMDS endpoint (applicable to AWS EKS only)
        - fd00:ec2::254/128

Managed vs Self-Hosted Bare Metal Comparison

Capability AWS EKS (Pod Identity) GCP GKE (WIF) Azure AKS (Entra WI) Bare Metal: OIDC Federation Bare Metal: SPIFFE/SPIRE
Identity Token Format Projected SA JWT (pods.eks.amazonaws.com) GKE Metadata Server token Projected SA JWT (api://AzureADTokenExchange) Projected SA JWT (--service-account-issuer) X.509-SVID (mTLS) + JWT-SVID (spiffe://...)
Control-Plane Dependency EKS Auth API + Node DaemonSet (169.254.170.23) Node-local gke-metadata-server AKS OIDC Issuer + Mutating Webhook Publicly reachable .well-known/openid-configuration + JWKS SPIRE Server + SPIRE Agent DaemonSet + csi.spiffe.io
Hardware Node Attestation AWS Nitro hypervisor (implicit) GCP Shielded VM (implicit) Azure Trusted Launch (implicit) None (TokenReview only) Native TPM 2.0 (tpm_devid) on bare-metal agents (or k8s_psat on non-TPM nodes)
Container Image / Binary Attestation No (Namespace + SA only) No (Namespace + SA only) No (Namespace + SA only) No (Namespace + SA only) Yes (k8s workload attestor verifies image digest, UID, cgroup)
Native mTLS Certificate Issuance No (IAM API tokens only) Separate (Cloud Service Mesh) Separate (Istio add-on) No (JWT only) Yes (Short-lived X.509-SVIDs auto-rotated over UNIX socket)

Self-Hosted Bare Metal: Building Workload Identity

On bare metal, there is no 169.254.169.254 metadata server waiting to hand out IAM credentials. You have two clean architectural patterns to eliminate static secrets depending on whether you need simple JWT federation or full cryptographic X.509 workload identity.

Pattern 1: Publishing the kube-apiserver OIDC Issuer

Every Kubernetes API server is already a compliant OIDC token issuer. When you configure --service-account-issuer=https://oidc.k8s.bard.sh on kube-apiserver, it serves OIDC discovery metadata at /.well-known/openid-configuration and its public signing keys at /openid/v1/jwks.

If your bare-metal workloads only need to authenticate to OpenBao, HashiCorp Vault, or an external cloud provider (AWS IAM, GCP WIF, Azure Entra), you do not need any extra in-cluster agent:

  1. For in-cluster or on-prem OpenBao/Vault, configure the JWT/OIDC auth engine against your cluster's OIDC discovery URL and CA bundle so OpenBao verifies bound projected tokens (aud: https://openbao.bard.sh) locally using cached JWKS keys rather than making a TokenReview callback to kube-apiserver on every login.
  2. For external cloud IAM (hybrid bare-metal pods calling AWS S3 or GCP BigQuery), export the static outputs of kubectl get --raw /.well-known/openid-configuration and kubectl get --raw /openid/v1/jwks to a public CDN bucket or an unauthenticated read-only reverse proxy route at https://oidc.k8s.bard.sh (these files contain only public RSA/ECDSA verification keys - never private keys). Then register https://oidc.k8s.bard.sh as an IAM OIDC Provider in AWS or a Workload Identity Pool in GCP.

Pattern 2: SPIFFE/SPIRE End-to-End Architecture

Publishing the API server's OIDC issuer works well for cloud API calls, but it has two blind spots on bare metal: it only issues JWTs (not X.509 certificates for service-to-service mTLS), and its trust is rooted solely in the Kubelet's ServiceAccount token rather than physical hardware attestation.

For high-assurance bare-metal clusters, deploy SPIFFE/SPIRE. SPIFFE (Secure Production Identity Framework for Everyone) assigns every workload a cryptographic URI (spiffe://prod.bard.sh/ns/payments/sa/checkout-api) encoded inside short-lived X.509-SVIDs (for mTLS) and JWT-SVIDs (for API and OpenBao authentication).

Bare-Metal Workload Identity with SPIFFE/SPIRE and OpenBao

1. Node Attestation: Replacing k8s_psat with TPM 2.0 (tpm_devid) on Bare Metal

When a SPIRE Agent DaemonSet starts on a bare-metal worker node, it must prove its identity to the central SPIRE Server before it is allowed to request workload identities for pods scheduled on that node.

A SPIRE Agent supports strictly one NodeAttestor plugin. On standard cloud or VM clusters without hardware TPMs, the baseline node attestor is k8s_psat (Projected ServiceAccount Token), where SPIRE Server verifies the agent's token against kube-apiserver via the TokenReview API. On bare metal with TPM 2.0 chips, tpm_devid replaces k8s_psat as the agent's single NodeAttestor, requiring the node's physical TPM 2.0 chip to sign a cryptographic challenge using a manufacturer-provisioned or factory-enrolled DevID key. Even if an attacker steals a worker node's kubeconfig, they cannot spin up a rogue VM on the management network to impersonate that node to SPIRE without physical possession of the server's TPM 2.0 chip. (SPIRE Server can still configure both tpm_devid and k8s_psat server-side if you manage a mixed cluster of bare-metal and non-TPM nodes, while each agent uses its single configured NodeAttestor.)

Meanwhile, the k8s WorkloadAttestor plugin remains active on every agent to verify local pods (namespace, ServiceAccount, pod UID, and container image digest) against the Kubelet API.

2. Safe Socket Delivery with the SPIFFE CSI Driver (csi.spiffe.io)

Pods fetch their SVIDs from the local SPIRE Agent over a UNIX domain socket implementing the SPIFFE Workload API. Early SPIRE deployments mounted this socket from the host filesystem using a hostPath volume.

Do not use hostPath volumes for the SPIRE socket in production. Enabling hostPath violates the Kubernetes restricted Pod Security Standard (PSS) and creates a dangerous node filesystem exposure if misconfigured. Instead, deploy the upstream SPIFFE CSI Driver (spiffe/spiffe-csi, driver name csi.spiffe.io) alongside the SPIRE Agent DaemonSet. The driver bind-mounts the SPIRE Agent's Workload API socket directory (containing agent.sock) read-only into application pods as an ephemeral csi volume while keeping application namespaces locked at pod-security.kubernetes.io/enforce: restricted. The application (or its SPIFFE SDK) then dials the SPIRE Agent directly over unix:///run/spire/socket/agent.sock to stream short-lived SVIDs.

Note: Do not confuse csi.spiffe.io (spiffe/spiffe-csi) with cert-manager's CSI driver, which writes static certificate files into pods rather than exposing the SPIRE Workload API socket. When pairing csi.spiffe.io with Kubernetes User Namespaces (hostUsers: false), verify UNIX socket permissions (0666/0755 on the socket directory) and SELinux contexts on enforcing nodes, because VFS idmap mounts do not translate SELinux labels or host socket permissions for pre-existing UNIX domain sockets.

3. Declarative Registration via spire-controller-manager (ClusterSPIFFEID)

Instead of running imperative spire-server entry create CLI commands, deploy spire-controller-manager alongside the SPIRE Server. It watches Kubernetes Pods, Nodes, and ClusterSPIFFEID Custom Resources, automatically registering workloads that match your namespace, label, and image constraints:

apiVersion: spire.spiffe.io/v1alpha1
kind: ClusterSPIFFEID
metadata:
  name: payments-workloads
spec:
  spiffeIDTemplate: "spiffe://{{ .TrustDomain }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}"
  namespaceSelector:
    matchLabels:
      kubernetes.io/metadata.name: payments
  podSelector:
    matchExpressions:
      - key: security.bard.sh/spire-enabled
        operator: In
        values: ["true"]
  # Workload attestor verifies the pod via the local Kubelet API
  workloadSelectorTemplates:
    - "k8s:ns:{{ .PodMeta.Namespace }}"
    - "k8s:sa:{{ .PodSpec.ServiceAccountName }}"
    - "k8s:pod-uid:{{ .PodMeta.UID }}"
  ttl: 1h
  jwtTtl: 15m

To wire the hardened checkout-api Deployment from the baseline section above into SPIRE, add the security.bard.sh/spire-enabled: "true" pod label and replace the vault-bound-token projected volume and mount in your Deployment manifest with the csi.spiffe.io Workload API socket mount (or remove vault-bound-token explicitly with $patch: delete if applying via kubectl patch):

# Deployment overlay for the hardened checkout-api Deployment above (with vault-bound-token removed)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-api
  namespace: payments
spec:
  template:
    metadata:
      labels:
        security.bard.sh/spire-enabled: "true"
    spec:
      containers:
        - name: app
          env:
            - name: SPIFFE_ENDPOINT_SOCKET
              value: unix:///run/spire/socket/agent.sock
          volumeMounts:
            - name: spire-agent-socket
              mountPath: /run/spire/socket
              readOnly: true
      volumes:
        - name: spire-agent-socket
          csi:
            driver: "csi.spiffe.io"
            readOnly: true

4. Exchanging SPIFFE SVIDs with OpenBao for Dynamic Credentials

Once the pod has /run/spire/socket/agent.sock, it dials the SPIRE Agent over the local UNIX socket to request a short-lived JWT-SVID (aud: openbao.bard.sh) and exchanges it with OpenBao (or HashiCorp Vault) to receive a dynamic 15-minute PostgreSQL username and password. OpenBao verifies the JWT-SVID locally against SPIRE Server's cached OIDC Discovery JWKS endpoint and binds each role strictly to bound_subject:

# Configure OpenBao JWT Auth to trust the SPIRE Server OIDC Discovery Provider
bao write auth/spiffe-jwt/config \
  oidc_discovery_url="https://spire-oidc.bard.sh" \
  oidc_discovery_ca_pem=@/etc/ssl/certs/bard-root-ca.pem \
  bound_issuer="https://spire-oidc.bard.sh"

# Bind the exact SPIFFE ID to a least-privilege OpenBao policy
bao write auth/spiffe-jwt/role/checkout-db-reader \
  role_type="jwt" \
  user_claim="sub" \
  bound_audiences="openbao.bard.sh" \
  bound_subject="spiffe://prod.bard.sh/ns/payments/sa/checkout-api" \
  token_ttl="15m" \
  token_max_ttl="30m" \
  token_policies="payments-postgres-dynamic-rw"

Not a single static password, API token, or long-lived certificate ever touches Git, Helm values, or etcd.

Operational Pitfalls to Watch For

  • SDK credential chain caching during migration: When migrating an existing workload from static AWS environment variables (AWS_ACCESS_KEY_ID) to EKS Pod Identity, remember that the default AWS SDK credential provider chain evaluates environment variables before container/pod identity credentials. If old Secret env vars remain in the Deployment manifest, the pod will silently continue using the static IAM user key until you delete it.
  • SDK version floor for EKS Pod Identity: EKS Pod Identity requires recent AWS SDK versions that recognize the AWS_CONTAINER_CREDENTIALS_FULL_URI (http://169.254.170.23/v1/credentials) and AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE environment variables injected by the EKS webhook. Legacy containers bundling older boto3 releases or AWS CLI v1 will fail credential resolution with InvalidEndpoint or fall back to IMDS.
  • Public JWKS bucket availability on bare metal: If you use Pattern 1 (exporting kube-apiserver JWKS to an external S3/GCS bucket for cloud federation) and rotate your API server service account signing key (--service-account-signing-key-file), you must publish the new public key to the external JWKS file before kube-apiserver begins signing tokens with it. Otherwise, every pod's cloud API call will fail signature verification until the JWKS cache expires.
  • SPIRE Server backing store availability: On bare metal, SPIRE Server stores registration entries and CA state in a backing relational datastore (PostgreSQL / CloudNativePG [CNCF Incubating] or SQLite on persistent storage). While running SPIRE Agents continue serving cached SVIDs to already-running pods if the SPIRE Server goes down briefly, new pods cannot attest once SVID TTLs expire. Run SPIRE Server as a multi-replica HA deployment backed by a replicated PostgreSQL cluster and alert on spire_server_manager_x509_ca_rotate_max_expiration so intermediate CA rotation failures surface long before expiry.

Day-1 Verification & Operational Runbook

Verify your cluster's workload identity posture immediately after rollout:

# 1. Find non-system pods that actually mounted a default kube-api-access-* ServiceAccount token volume
kubectl get pods -A -o json | jq -r '
  .items[]
  | select(.metadata.namespace | IN("kube-system","cilium","spire-system") | not)
  | select([.spec.volumes[]? | select(.name | startswith("kube-api-access-"))] | length > 0)
  | "\(.metadata.namespace)/\(.metadata.name)"
'

# 2. Decode a bound projected token's claims safely (base64url -> standard base64 with padding)
# For distroless images without cat, verify token minting via `kubectl create token checkout-api -n payments --audience https://openbao.bard.sh`
kubectl exec -n payments deploy/checkout-api -- cat /var/run/secrets/tokens/openbao-token \
  | cut -d. -f2 \
  | tr '_-' '/+' \
  | awk '{ l=length($0)%4; if (l==2) print $0"=="; else if (l==3) print $0"="; else print $0 }' \
  | base64 -d | jq '{aud, sub, exp, iat, k8s: .["kubernetes.io"]}'
  • Pre-publish signing keys 24 hours ahead of rotation: Before rotating --service-account-signing-key-file on a bare-metal API server that federates OIDC to cloud IAM or OpenBao, publish the new public key to the JWKS endpoint at least 24 hours before switching the active signing key.
  • Audit EKS Pod Identity trust policies regularly: Verify every IAM role trusting pods.eks.amazonaws.com includes an aws:SourceAccount and aws:SourceArn (or aws:RequestTag/eks-cluster-arn) condition so non-production clusters cannot assume production roles.
  • Alert on SPIRE CA expiration and socket health: Track spire_server_manager_x509_ca_rotate_max_expiration in Prometheus and run a synthetic canary pod validating csi.spiffe.io socket connectivity on every node pool using hostUsers: false.

Series Navigation