Identity, Secrets and Config Errors — Workload Identity, Stale ConfigMaps and Secret Stores

Pods that run fine but cannot reach a cloud API, read yesterday's config, or never start because the secret store said no: workload identity on EKS, AKS and GKE, ConfigMap delivery, Secrets Store CSI and External Secrets.

Overview

This layer covers how a workload proves who it is and how it gets its settings. The failures are unusual because the pod usually looks healthy. It is Running and Ready, yet every call to a cloud API returns access denied, or it keeps using a value you changed an hour ago. Nothing in kubectl get pods looks wrong, so these are the errors most often misread as application bugs.

You work outside-in along the chain. For identity the chain is: ServiceAccount, the admission webhook that injects a token, the projected token itself, the cloud trust rule that accepts it, and finally the permission on the resource. For configuration the chain is: the object in the API, the delivery method (environment variable, volume, subPath), the kubelet sync, and whether the application re-reads what it was given. Find the first broken link and you have the cause.

The one idea to keep: the object in the API is not what the container sees. Always compare the two directly, with kubectl exec or a test pod that uses the same ServiceAccount, before you change anything.

Symptom to first command

Each symptom below points at one link in the chain, so each comes with its most likely cause and the first command to run.

  • Assume denied: AccessDenied ... AssumeRoleWithWebIdentity most often means the trust policy sub does not match the pod's namespace and ServiceAccount. Read the trust policy with aws iam get-role --role-name orders-role --query Role.AssumeRolePolicyDocument.
  • No OIDC provider: InvalidIdentityToken: No OpenIDConnect provider found means the cluster's OIDC issuer is not registered in IAM. List the providers with aws iam list-open-id-connect-providers.
  • Wrong identity: when the SDK uses the node role, or reports NoCredentialProviders, the webhook did not inject, usually because the pod predates the annotation. Run kubectl get pod -n prod -o yaml and look for AWS_ROLE_ARN.
  • Azure subject mismatch: AADSTS70021: No matching federated identity record found means the federated credential's issuer or subject does not match. Run az identity federated-credential list --identity-name orders-id -g rg-prod.
  • Stale value: when a ConfigMap changed but the pod still has the old value, the value was delivered as an env var or through subPath. Run kubectl get pod -n prod -o yaml and look for envFrom or subPath.
  • Secret mount failed: MountVolume.SetUp failed for volume "secrets-store" means the identity cannot read the secret, or the name is wrong. Read the events with kubectl events -n prod --for pod/.
  • Sync error: an ExternalSecret in SecretSyncedError has an invalid SecretStore, or the key is missing in the vault. Start with kubectl get externalsecret,secretstore -n prod.
  • Expiry after hours: ExpiredToken or AADSTS700024 after hours of uptime means the app read the token file once and cached it. Run kubectl exec -n prod -- env, then check how the app builds its client.

The figure puts both chains side by side. Red marks the link where each of these failures breaks.

Key concepts

  • Workload identity
  • Projected ServiceAccount token
  • Trust policy subject
  • EKS Pod Identity
  • Delivery method
  • Checksum annotation
  • Immutable ConfigMap
  • SecretProviderClass
  • refreshInterval

Interview questions

  • After moving the orders service from the default namespace to prod, every S3 call fails with AccessDenied on AssumeRoleWithWebIdentity. Nothing else changed. Walk me through it.
  • The orders ServiceAccount has the right role annotation, yet aws sts get-caller-identity inside the pod shows the node's instance role. Why?
  • We changed LOG_LEVEL in the orders ConfigMap ten minutes ago and nothing happened. How do you fix it now, and how would you design config rollout so this does not recur?
  • Security rotated the database password in AWS Secrets Manager. Some orders pods now fail to authenticate and others work. Walk me through it.
  • How does workload identity differ between EKS, AKS and GKE, and where does each one usually break?
  • After adding a new node pool, new orders pods on those nodes stay in ContainerCreating with FailedMount for secrets-store, while pods on old nodes are fine. What happened?
  • A nightly batch job that runs about 26 hours fails near the end with ExpiredToken. Shorter jobs never fail. What do you look at?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio