EKS Pod Identity credential selection: prove which role the application actually uses
Trace EKS Pod Identity from service-account association through the node agent to the SDK. Diagnose old credentials that take precedence over the intended workload role.
TL;DR: Creating an EKS Pod Identity association does not force every application to use it. The SDK must support the provider and select it in its credential chain. Earlier credentials can keep winning, so verify caller identity from the application's actual runtime before editing permissions.
Follow the credential request
An association links a cluster namespace and service account to an IAM role. For supported workloads, EKS injects information allowing the SDK's container credential provider to obtain temporary credentials through the Pod Identity Agent. The agent participates in the EKS Auth flow; the application uses the resulting credentials to call AWS services.
AWS explains this in how Pod Identity works. IAM roles for service accounts, commonly IRSA, uses a different web-identity exchange path. Avoid combining setup instructions from those mechanisms without deciding which provider should serve the workload.
Provider precedence can mask a correct association
In this teaching case, a Deployment still injects static AWS credentials from a Secret. An operator adds a Pod Identity association with a narrow role and expects the application to switch. The SDK continues using the earlier credentials, so requests arrive under the previous identity.
The association can be configured correctly while unused. Inspect the application's credential-provider configuration and sanitized identity evidence. Do not print access keys or tokens. A separate debug container running a different SDK or environment may select a different provider, so establish identity through the same runtime path as the failing application where feasible.
| Evidence | Interpretation | Next check |
|---|---|---|
| Unexpected caller role | Another provider may be selected | Explicit credentials, environment and shared configuration |
| No credentials available | Provider or delivery path may be absent | Supported SDK, agent, association and Pod settings |
| Intended role, API denied | Credential selection worked | Role/resource policy and requested operation |
| Wrong namespace/service account | Association may target another workload | Actual Pod identity, not Deployment assumptions |
Migrate with a controlled positive and negative test
Confirm the SDK version supports Pod Identity using AWS's minimum SDK reference. Verify the agent and supported compute configuration, association, role trust and node-side requirements for the target cluster. Restart or replace Pods as required to obtain the intended injected configuration; changing a control-plane association is not proof that an existing process has refreshed its credentials.
In a test workload, remove the competing credential source under a reviewed change and verify the intended caller role. Test one required API operation and one forbidden operation. A successful identity lookup establishes who called, not that the role has the correct least-privilege boundary.
Restrict access to unintended node credentials where supported and review SDK fallback behavior. A denied intended provider should not silently grant broader authority through another path. Keep rollback about restoring a known credential configuration, with old secret revocation handled after successful migration evidence.
Self-check: the AWS CLI in a debug Pod reports the intended role, but the application still uses its old role. Which result wins? Neither substitutes for the other. Compare SDK versions, explicit provider choices and environment in the actual application container.
Practice the old-role migration failure.