You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pod Identities] is a new way of delivering AWS credentials to your
184
-
workloads running on EKS. EKS pod identities simplifies the
185
-
configuration of AWS resources as you no longer need to manage OIDC
186
-
configurations to deliver AWS credentials to your pods on EKS.
183
+
Pod Identities] provide another way to deliver temporary AWS credentials to your workloads running on EKS. EKS Pod Identities integrate with the EKS control plane and an on-cluster agent so that pods receive credentials without requiring you to create or manage an IAM OIDC identity provider. EKS Pod Identities are the recommended approach for new workloads on https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html#pod-id-considerations[supported node types], while IRSA remains a fully supported alternative.
187
184
188
-
====== Enabling EKS Pod Identities for cross account access
189
-
190
-
Unlike IRSA, EKS Pod Identities can only be used to directly grant
191
-
access to a role in the same account as the EKS cluster. To access a
192
-
role in another AWS account, pods that use EKS Pod Identities must
With EKS Pod Identities, you associate a Kubernetes service account in your cluster with an IAM role in the same AWS account as the cluster. EKS uses this association to obtain temporary credentials for that IAM role and securely deliver them to pods that use the service account. Your application can then use standard AWS SDKs and the default credential chain to call AWS APIs; no custom credential providers or configuration files are required.
You can create an aws config file as shown above with both Account A and
227
-
B roles and specify the AWS_CONFIG_FILE and AWS_PROFILE env vars in your
228
-
pod spec. EKS Pod identity webhook does not override if the env vars
229
-
already exists in the pod spec.
230
-
231
-
[source,yaml]
232
-
----
233
-
# Snippet of the PodSpec
234
-
containers:
235
-
- name: container-name
236
-
image: container-image:version
237
-
env:
238
-
- name: AWS_CONFIG_FILE
239
-
value: path-to-customer-provided-aws-config-file
240
-
- name: AWS_PROFILE
241
-
value: account_b_role
242
-
----
188
+
====== Enabling EKS Pod Identities for cross account access
189
+
EKS Pod Identities natively support cross account access by using a target IAM role in the workload account and IAM role chaining. When you create a Pod Identity association for a Kubernetes service account, you specify both a pod IAM role in the cluster account and a target IAM role in the workload account. EKS Pod Identity uses the pod role to assume the target role and returns temporary credentials for the target role to the pod.
243
190
244
-
When configuring role trust policies for role chaining with EKS pod
specific attributes] as session tags and use attribute based access
248
-
control(ABAC) to limit access to your IAM roles to only specific EKS Pod
249
-
identity sessions, such as the Kubernetes Service Account a pod belongs
250
-
to.
251
-
252
-
Please note that some of these attributes may not be universally unique,
253
-
for example two EKS clusters may have identical namespaces, and one
254
-
cluster may have identically named service accounts across namespaces.
255
-
So when granting access via EKS Pod Identities and ABAC, it is a best
256
-
practice to always consider the cluster arn and namespace when granting
257
-
access to a service account.
191
+
Refer to this https://aws.amazon.com/blogs/containers/amazon-eks-pod-identity-a-new-way-for-applications-on-eks-to-obtain-iam-credentials/[AWS blog] for a detailed walkthrough and considerations of this approach.
258
192
259
193
====== ABAC and EKS Pod Identities for cross account access
260
194
@@ -264,30 +198,60 @@ assign a unique IAM role for each service account that needs to access
264
198
another account, or use a common IAM role across multiple service
265
199
accounts and use ABAC to control what accounts it can access.
266
200
267
-
To use ABAC to control what service accounts can assume a role into
268
-
another account with role chaining, you create a role trust policy
269
-
statement that only allows a role to be assumed by a role session when
270
-
the expected values are present. The following role trust policy will
271
-
only let a role from the EKS cluster account (account ID 111122223333)
272
-
assume a role if the `kubernetes-service-account`, `eks-cluster-arn`
273
-
and `kubernetes-namespace` tags all have the expected value.
201
+
To use ABAC to control what service accounts can assume a role into another account with role chaining, you create a role trust policy statement that only allows a role to be assumed by the pod IAM role from the EKS cluster account (account ID 111122223333) when the expected values are present. The following role trust policy will only let the pod IAM role from the EKS cluster account assume a role if the `kubernetes-service-account`, `eks-cluster-arn` and `kubernetes-namespace` tags all have the expected value.
When using this strategy it is a best practice to ensure that the common
281
-
IAM role only has `sts:AssumeRole` permissions and no other AWS
282
-
access.
283
-
284
-
It is important when using ABAC that you control who has the ability to
285
-
tag IAM roles and users to only those who have a strict need to do so.
286
-
Someone with the ability to tag an IAM role or user would be able to set
287
-
tags on roles/users identical to what would be set by EKS Pod Identities
288
-
and may be able to escalate their privileges. You can restrict who has
289
-
the access to set tags the `kubernetes-` and `eks-` tags on IAM role
290
-
and users using IAM policy, or Service Control Policy (SCP).
230
+
You can also use EKS Pod Identity session policies to further scope down permissions for a pod without creating additional IAM roles. Session policies are applied when EKS Pod Identity assumes the role and the resulting permissions are the intersection of the role policy and the session policy; for considerations and detailed steps, refer to the AWS Containers blog https://aws.amazon.com/blogs/containers/session-policies-for-amazon-eks-pod-identity/[Session policies for Amazon EKS Pod Identity].
231
+
232
+
When using this strategy it is a best practice to ensure that the common IAM role only has `sts:AssumeRole` and `sts:TagSession` permissions and no other AWS access.
233
+
234
+
It is important when using ABAC that you control who has the ability to tag IAM roles, users, and STS sessions to only those who have a strict need to do so. Someone with the ability to set `kubernetes-` or `eks-` tags may be able to set tags identical to what would be passed during EKS Pod Identity role chaining and may be able to escalate their privileges. You can restrict who has access to set these tags using IAM policy or Service Control Policy (SCP); for example controls, refer to https://github.com/aws-samples/service-control-policy-examples/blob/main/Service-specific-controls/Amazon-EKS/ProtectPodIdentitiesTagsOnRolesAndUsers.json[ProtectPodIdentitiesTagsOnRolesAndUsers] and https://github.com/aws-samples/resource-control-policy-examples/blob/main/Service-specific-controls/STS-Protect-EKS-pod-identities-tags.json[STS-Protect-EKS-pod-identities-tags].
235
+
236
+
====== Choosing Between EKS Pod Identities and IRSA
237
+
238
+
Both IRSA and EKS Pod Identities are valid options for delivering temporary AWS credentials to your EKS workloads. EKS Pod Identities are recommended for new applications running on https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html#pod-id-considerations[supported node types] and IRSA is a good fit where you already have OIDC and IRSA in place or run on platforms that EKS Pod Identities do not support.
239
+
240
+
Consider the following when deciding which to use:
241
+
242
+
* **Choose EKS Pod Identities when:**
243
+
** You are designing new workloads and want to avoid creating and managing IAM OIDC identity providers.
244
+
** You want native support for cross account access using a target IAM role without adding custom credential scripts or AWS configuration files to your pods.
245
+
** You prefer that cluster administrators manage which Kubernetes service accounts may assume which roles, while IAM administrators manage the permissions of those roles.
246
+
** You want credential vending to scale efficiently and avoid reaching the IAM Quota limits.
247
+
248
+
* **Choose IRSA when:**
249
+
** You already use IRSA successfully and have a standard pattern for OIDC providers and IAM roles.
250
+
** Your workloads run on environments where EKS Pod Identities are not supported, such as AWS Fargate, Windows nodes, or applications using un-supported AWS SDKs.
251
+
** You require a direct OIDC-based federation model to roles in your workload accounts, and your security controls are already built around OIDC providers.
252
+
253
+
IRSA and EKS Pod Identities both support multi-account strategies. You can use either approach consistently across your cluster or adopt a mixed model where legacy workloads continue to use IRSA and new workloads use EKS Pod Identities.
0 commit comments