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
Copy file name to clipboardExpand all lines: docs/content/en/docs/getting-started/optional/irsa.md
+51-25Lines changed: 51 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,11 @@ IAM Roles for Service Account (IRSA) enables applications running in clusters to
14
14
15
15
The steps below are based on the [guide for configuring IRSA for DIY Kubernetes,](https://github.com/aws/amazon-eks-pod-identity-webhook/blob/master/SELF_HOSTED_SETUP.md) with modifications specific to EKS Anywhere's cluster provisioning workflow. The main modification is the process of generating the keys.json document. As per the original guide, the user has to create the service account signing keys, and then use that to create the keys.json document prior to cluster creation. This order is reversed for EKS Anywhere clusters, so you will create the cluster first, and then retrieve the service account signing key generated by the cluster, and use it to create the keys.json document. The sections below show how to do this in detail.
16
16
17
-
### Create an OIDC provider and make its discovery document publicly accessible
17
+
### Set up cluster-wide IRSA infrastructure
18
+
19
+
This section covers the one-time setup required for IRSA on your EKS Anywhere cluster. Complete these steps once per cluster.
20
+
21
+
#### Create an OIDC provider and make its discovery document publicly accessible
18
22
19
23
You must use a single OIDC provider per EKS Anywhere cluster, which is the best practice to prevent a token from one cluster being used with another cluster. These steps describe the process of using a S3 bucket to host the OIDC `discovery.json` and `keys.json` documents.
20
24
@@ -54,11 +58,15 @@ You must use a single OIDC provider per EKS Anywhere cluster, which is the best
54
58
55
59
1. Make a note of the `Provider` field of OIDC provider after it is created.
56
60
57
-
1. Assign an IAM role to the OIDC provider.
61
+
### Create IAM role for your workload
62
+
63
+
Each workload (such as ADOT, cert-manager, or custom applications) should have its own dedicated IAM role with only the permissions it needs. Repeat this section for each workload that requires AWS access.
64
+
65
+
1. Create an IAM role for your workload:
58
66
59
67
1. Navigate to the AWS IAM Console.
60
68
61
-
1. Click on the OIDC provider.
69
+
1. Click on the OIDC provider created in the previous section.
62
70
63
71
1. Click _Assign role_.
64
72
@@ -73,10 +81,10 @@ You must use a single OIDC provider per EKS Anywhere cluster, which is the best
73
81
74
82
1. Click _Next_.
75
83
76
-
1. Configure your desired _Permissions poilicies_.
84
+
1. Configure _Permissions policies_ specific to this workload's requirements.
77
85
78
-
1. Below is a sample trust policy of IAM role foryour pods. Replace `ACCOUNT_ID`, `ISSUER_HOSTPATH`, `NAMESPACE` and `SERVICE_ACCOUNT`.
79
-
_Example: Scoped to a service account_
86
+
1. Below is a sample trust policy for a single workload. Replace `ACCOUNT_ID`, `ISSUER_HOSTPATH`, `NAMESPACE` and `SERVICE_ACCOUNT` with values specific to this workload.
87
+
_Example: Scoped to a single service account_
80
88
```json
81
89
{
82
90
"Version": "2012-10-17",
@@ -90,7 +98,7 @@ You must use a single OIDC provider per EKS Anywhere cluster, which is the best
@@ -99,7 +107,7 @@ You must use a single OIDC provider per EKS Anywhere cluster, which is the best
99
107
100
108
1. Create the IAM Role and make a note of the _Role name_.
101
109
102
-
1. After the cluster is created you can grant service accounts access to the role by modifying the trust relationship. See the [How to use trust policies with IAM Roles](https://aws.amazon.com/blogs/security/how-to-use-trust-policies-with-iam-roles/) for more information on trust policies. Refer to [Configure the trust relationship for the OIDC provider's IAM Role](#configure-the-trust-relationship-for-the-oidc-providers-iam-role) for a working example.
110
+
1. See the [How to use trust policies with IAM Roles](https://aws.amazon.com/blogs/security/how-to-use-trust-policies-with-iam-roles/) for more information on trust policies. For advanced trust relationship configurations, refer to [Configure the trust relationship for the IAM role](#configure-the-trust-relationship-for-the-iam-role).
103
111
104
112
### Create (or upgrade) the EKS Anywhere cluster
105
113
@@ -197,24 +205,39 @@ The [Amazon Pod Identity Webhook](https://github.com/aws/amazon-eks-pod-identity
197
205
1. You can validate IRSA by following [IRSA setup and test]({{< relref "../../packages/adot/adot_amp_amg/#irsa-set-up-test">}}). Ensure the awscli pod is deployed in the same namespace of ServiceAccount `pod-identity-webhook`.
198
206
199
207
200
-
### Configure the trust relationship for the OIDC provider's IAM Role
208
+
### Configure the trust relationship for the IAM role
201
209
202
-
In order to grant certain service accounts access to the desired AWS resources, edit the trust relationshipforthe OIDC provider's IAM Role (`OIDC_IAM_ROLE`) createdin the first section, and add in the desired service accounts.
210
+
This section provides advanced examples for configuring trust relationships. The basic single-ServiceAccount pattern shown above is recommendedformost use cases.
203
211
204
212
1. Choose the role in the console to open it for editing.
205
213
206
214
1. Choose the **Trust relationships** tab, and then choose **Edit trust relationship**.
207
215
208
-
1. Find the line that looks similar to the following:
209
-
```
210
-
"$ISSUER_HOSTPATH:aud": "sts.amazonaws.com"
211
-
```
216
+
1. Find the existing trust policy condition.
212
217
213
-
1. Add another condition after that line which looks like the following line. Replace `KUBERNETES_SERVICE_ACCOUNT_NAMESPACE` and `KUBERNETES_SERVICE_ACCOUNT_NAME` with the name of your Kubernetes service account and the Kubernetes namespace that the account exists in.
The allow list example below applies `my-serviceaccount` service account to the `default` namespace and all service accounts to the `observability` namespace for the `us-west-2` region. Remember to replace `Account_ID` and `S3_BUCKET` with the required values.
239
+
240
+
1. **Multiple ServiceAccounts pattern (use sparingly):** Only use arrays when the same workload runs in multiple namespaces (e.g., dev/staging/prod environments):
218
241
```json
219
242
{
220
243
"Version": "2012-10-17",
@@ -226,19 +249,22 @@ In order to grant certain service accounts access to the desired AWS resources,
**Important:** Do not share IAM roles across unrelated workloads. Each workload should have its own IAM role with only the permissions it needs.
267
+
242
268
243
269
244
270
1. Refer [this](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) doc fordifferent ways of configuring one or multiple service accounts through the condition operatorsin the trust relationship.
0 commit comments