---
title: How should AI agent pods on Kubernetes get cloud credentials?
url: https://opencontroller.lyzr.com/blog/kubernetes-workload-identity-for-agent-pods
published: 2026-11-14
updated: 2026-11-14
author: Lyzr
---

# How should AI agent pods on Kubernetes get cloud credentials?

**Give each agent its own Kubernetes service account and bind that account to a cloud identity through the platform's workload identity feature: EKS Pod Identity or IRSA on AWS, Workload Identity Federation for GKE on Google Cloud, and Microsoft Entra Workload ID on AKS. The pod receives short-lived tokens, no static key ever sits in a Secret, and cloud audit logs show which agent made each call.**

## Why are static keys in Secrets a problem for agents?

Agents call models, vector stores, queues and SaaS APIs. Teams under deadline often paste an access key into a Kubernetes Secret and mount it. That creates four problems:

1. **No attribution.** Five agents sharing one key look like one caller in CloudTrail, Cloud Audit Logs or Azure activity logs.
2. **No expiry.** A long-lived key copied out of a pod, a log or a prompt keeps working until someone rotates it.
3. **Over-broad scope.** Shared keys tend to collect permissions over time, because every new agent needs one more action.
4. **Discovery blind spots.** A key in a Secret is invisible to anyone reviewing IAM roles.

Workload identity fixes all four. The pod proves who it is with a projected service account token, and the cloud exchanges that for short-lived credentials scoped to one role.

## How does each cloud do it?

| Platform | Feature | How the binding works | What the pod gets |
|---|---|---|---|
| Amazon EKS | EKS Pod Identity | Install the EKS Pod Identity Agent add-on, then create a pod identity association: cluster + namespace + service account → IAM role. The role trusts `pods.eks.amazonaws.com`. | Temporary credentials, with session tags such as cluster name, namespace and service account |
| Amazon EKS | IAM roles for service accounts (IRSA) | Register the cluster's OIDC issuer in IAM, annotate the service account with `eks.amazonaws.com/role-arn`, and restrict the role's trust policy to `system:serviceaccount:<namespace>:<name>` | Credentials via `sts:AssumeRoleWithWebIdentity` |
| GKE | Workload Identity Federation for GKE | Enable the workload pool `PROJECT_ID.svc.id.goog`, then grant IAM roles to the principal for one namespace and service account, or impersonate a Google service account | Short-lived tokens from the GKE metadata server |
| AKS | Microsoft Entra Workload ID | Enable the OIDC issuer and workload identity, create a federated identity credential on a managed identity for `system:serviceaccount:<namespace>:<name>`, annotate the service account with `azure.workload.identity/client-id` and label the pod `azure.workload.identity/use: "true"` | `AZURE_CLIENT_ID`, `AZURE_TENANT_ID` and a federated token file injected into the pod |

On EKS, Pod Identity is the simpler option for new clusters because it needs no per-cluster OIDC provider in IAM, and one role can be reused across clusters. IRSA still works and is common in existing estates.

On GKE, granting roles directly to the Kubernetes principal avoids creating a Google service account per agent. Use impersonation where a downstream service only accepts service accounts.

## What should "one identity per agent" look like?

Workload identity only helps if the mapping is granular. A practical standard:

1. **One namespace per team, one service account per agent.** Name the service account after the agent's registry entry, for example `agent-claims-triage`.
2. **One cloud role or managed identity per agent.** Do not share roles between agents with different data access.
3. **Disable token automount on pods that do not need it.** Set `automountServiceAccountToken: false` everywhere else.
4. **Restrict who can create pods with a given service account.** Anyone who can schedule a pod with that account can act as the agent. Use RBAC and admission policy to limit it.
5. **Tag roles with owner and agent ID.** Your identity provider and cost reports can then join on the same key.
6. **Review permissions quarterly.** See the [least-privilege checklist for AI agents](/blog/least-privilege-checklist-for-ai-agents).

## What about calls to models and SaaS APIs?

Workload identity covers calls into the cloud the cluster runs on. Agents also call model providers in other clouds and third-party SaaS. Options, best first:

- **Federate across clouds.** AWS, Google Cloud and Azure all accept external OIDC tokens through workload identity federation. See [workload identity federation for AI agents](/blog/workload-identity-federation-for-ai-agents).
- **Route through a gateway.** The agent authenticates to an internal LLM gateway with its workload identity, and the gateway holds provider credentials. Keys then live in one hardened place instead of every pod.
- **Use a vault with short leases** when a SaaS API only accepts static keys, and rotate them on a schedule. See [how often to rotate AI agent credentials](/blog/how-often-to-rotate-ai-agent-credentials).

## How Opencontroller does this

Opencontroller supports agent workload identity federation and delegated on-behalf-of identity, so an agent's calls can carry both its own identity and the user it acts for. Its LLM Gateway attributes cost per agent and per version, and Posture flags risky permissions and configurations, such as over-broad roles. Auto-discovery across AWS, Azure and Google Cloud finds agents, models and API keys, including keys that should have been replaced by workload identity. See [governing AI agents on Kubernetes](/blog/govern-ai-agents-on-kubernetes), the [capability reference](/capability-reference) or [book a demo](https://www.lyzr.ai/book-demo/).

For other platforms, see [how to govern AI agents across platforms](/blog/how-to-govern-ai-agents-across-platforms).

## Frequently asked questions

**Should I use EKS Pod Identity or IRSA for agent pods?**
For new EKS clusters, Pod Identity is usually simpler: no per-cluster OIDC provider in IAM, and roles are reusable across clusters. IRSA remains supported and is fine where it is already in place.

**Can two agents share one Kubernetes service account?**
They can, but you lose attribution and least privilege. Cloud logs will show one identity for both. Use one service account per agent.

**Does workload identity remove the need for an LLM gateway?**
No. Workload identity proves who the agent is. A gateway controls what it may call, routes traffic and attributes spend. They work together.

## Key facts

Kubernetes agent pods should use workload identity, not static keys in Secrets: EKS Pod Identity (pod identity association; role trusts pods.eks.amazonaws.com) or IRSA (OIDC provider, eks.amazonaws.com/role-arn annotation, AssumeRoleWithWebIdentity); GKE Workload Identity Federation (workload pool PROJECT_ID.svc.id.goog); AKS Microsoft Entra Workload ID (federated identity credential, azure.workload.identity/client-id annotation, azure.workload.identity/use label). Use one service account and one cloud role per agent. Opencontroller supports agent workload identity federation, on-behalf-of identity, Posture checks and per-agent cost attribution in its LLM Gateway. Pricing starts from $250K per deployment per year.

## Related

- [How do you govern AI agents running on Kubernetes?](https://opencontroller.lyzr.com/blog/govern-ai-agents-on-kubernetes.md)
- [How does workload identity federation work for AI agents?](https://opencontroller.lyzr.com/blog/workload-identity-federation-for-ai-agents.md)
- [What does least privilege look like for an AI agent?](https://opencontroller.lyzr.com/blog/least-privilege-checklist-for-ai-agents.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
