Skip to content

Commit c319f71

Browse files
authored
Merge pull request #941 from awsdocs/pr-916
Style rewrites for PR 916
2 parents 57bf843 + 838bd78 commit c319f71

File tree

1 file changed

+57
-43
lines changed

1 file changed

+57
-43
lines changed

latest/ug/storage/efs-csi.adoc

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ link:efs/latest/ug/whatisefs.html[Amazon Elastic File System,type="documentation
2828
[#efs-csi-prereqs]
2929
== Prerequisites
3030

31-
* The EFS CSI driver needs {aws} IAM Permissions.
31+
* The Amazon EFS CSI driver needs {aws} Identity and Access Management (IAM) permissions.
3232
** {aws} suggests using EKS Pod Identities. For more information, see <<pod-id-setup-overview>>.
33-
** For information about IAM Roles for Service Accounts and setting up an {aws} Identity and Access Management (IAM) OpenID Connect (OIDC) provider for your cluster, see <<enable-iam-roles-for-service-accounts>>.
33+
** For information about IAM roles for service accounts and setting up an IAM OpenID Connect (OIDC) provider for your cluster, see <<enable-iam-roles-for-service-accounts>>.
3434
* Version `2.12.3` or later or version `1.27.160` or later of the {aws} Command Line Interface ({aws} CLI) installed and configured on your device or {aws} CloudShell. To check your current version, use `aws --version | cut -d / -f2 | cut -d ' ' -f1`. Package managers such `yum`, `apt-get`, or Homebrew for macOS are often several versions behind the latest version of the {aws} CLI. To install the latest version, see link:cli/latest/userguide/cli-chap-install.html[Installing, updating, and uninstalling the {aws} CLI,type="documentation"] and link:cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config[Quick configuration with aws configure,type="documentation"] in the _{aws} Command Line Interface User Guide_. The {aws} CLI version that is installed in {aws} CloudShell might also be several versions behind the latest version. To update it, see link:cloudshell/latest/userguide/vm-specs.html#install-cli-software[Installing {aws} CLI to your home directory,type="documentation"] in the _{aws} CloudShell User Guide_.
3535
* The `kubectl` command line tool is installed on your device or {aws} CloudShell. The version can be the same as or up to one minor version earlier or later than the Kubernetes version of your cluster. For example, if your cluster version is `1.29`, you can use `kubectl` version `1.28`, `1.29`, or `1.30` with it. To install or upgrade `kubectl`, see <<install-kubectl>>.
3636
@@ -57,9 +57,13 @@ The specific steps in this procedure are written for using the driver as an Amaz
5757
5858
====
5959

60-
=== `eksctl` [[eksctl_efs_store_app_data]]
61-
==== If Using Pod Identities
62-
Run the following commands to create an IAM role and Pod Identity association with `eksctl`. Replace [.replaceable]`my-cluster` with your cluster name and [.replaceable]`AmazonEKS_EFS_CSI_DriverRole` with the name for your role.
60+
[#eksctl_efs_store_app_data]
61+
=== `eksctl`
62+
63+
[#efs-eksctl-pod-identities]
64+
==== If using Pod Identities
65+
66+
Run the following commands to create an IAM role and Pod Identity association with `eksctl`. Replace `my-cluster` with your cluster name. You can also replace `AmazonEKS_EFS_CSI_DriverRole` with a different name.
6367

6468
[source,bash,subs="verbatim,attributes"]
6569
----
@@ -74,8 +78,10 @@ eksctl create podidentityassociation \
7478
--approve
7579
----
7680

77-
==== If Using IAM Roles for Service Accounts
78-
Run the following commands to create an IAM role with `eksctl`. Replace [.replaceable]`my-cluster` with your cluster name and [.replaceable]`AmazonEKS_EFS_CSI_DriverRole` with the name for your role.
81+
[#efs-eksctl-irsa]
82+
==== If using IAM roles for service accounts
83+
84+
Run the following commands to create an IAM role with `eksctl`. Replace `my-cluster` with your cluster name. You can also replace `AmazonEKS_EFS_CSI_DriverRole` with a different name.
7985

8086
[source,bash,subs="verbatim,attributes"]
8187
----
@@ -94,69 +100,70 @@ TRUST_POLICY=$(aws iam get-role --output json --role-name $role_name --query 'Ro
94100
aws iam update-assume-role-policy --role-name $role_name --policy-document "$TRUST_POLICY"
95101
----
96102

97-
=== {aws-management-console} [[console_efs_store_app_data]]
103+
[#console_efs_store_app_data]
104+
=== {aws-management-console}
98105
Run the following to create an IAM role with {aws-management-console}.
99106

100107
. Open the IAM console at https://console.aws.amazon.com/iam/.
101108
. In the left navigation pane, choose *Roles*.
102109
. On the *Roles* page, choose *Create role*.
103110
. On the *Select trusted entity* page, do the following:
104-
+
105-
.. If using *EKS Pod Identities*
106-
... In the *Trusted entity type* section, choose *AWS service*.
111+
.. If using EKS Pod Identities:
112+
... In the *Trusted entity type* section, choose *{aws} service*.
107113
... In the *Service or use case* drop down, choose *EKS*.
108114
... In the *Use case* section, choose *EKS - Pod Identity*.
109115
... Choose *Next*.
110-
.. If using *IAM Roles for Service Accounts*
116+
.. If using IAM roles for service accounts:
111117
... In the *Trusted entity type* section, choose *Web identity*.
112118
... For *Identity provider*, choose the *OpenID Connect provider URL* for your cluster (as shown under *Overview* in Amazon EKS).
113119
... For *Audience*, choose `sts.amazonaws.com`.
114120
... Choose *Next*.
115121
. On the *Add permissions* page, do the following:
116-
+
117-
.. In the *Filter policies* box, enter [.replaceable]`AmazonEFSCSIDriverPolicy`.
118-
.. Select the check box to the left of the [.replaceable]`AmazonEFSCSIDriverPolicy` returned in the search.
122+
.. In the *Filter policies* box, enter `AmazonEFSCSIDriverPolicy`.
123+
.. Select the check box to the left of the `AmazonEFSCSIDriverPolicy` returned in the search.
119124
.. Choose *Next*.
120125
. On the *Name, review, and create* page, do the following:
121-
+
122-
.. For *Role name*, enter a unique name for your role, such as [.replaceable]`AmazonEKS_EFS_CSI_DriverRole`.
126+
.. For *Role name*, enter a unique name for your role, such as `AmazonEKS_EFS_CSI_DriverRole`.
123127
.. Under *Add tags (Optional)*, add metadata to the role by attaching tags as key-value pairs. For more information about using tags in IAM, see link:IAM/latest/UserGuide/id_tags.html[Tagging IAM resources,type="documentation"] in the _IAM User Guide_.
124128
.. Choose *Create role*.
125129
. After the role is created:
126-
.. If using *EKS Pod Identities*
130+
.. If using EKS Pod Identities:
127131
... Open the link:eks/home#/clusters[Amazon EKS console,type="console"].
128132
... In the left navigation pane, select *Clusters*, and then select the name of the cluster that you want to configure the EKS Pod Identity association for.
129133
... Choose the *Access* tab.
130134
... In *Pod Identity associations*, choose *Create*.
131135
... Choose the *IAM role* dropdown and select your newly created role.
132-
... Choose the *Kubernetes namespace* field and input *kube-system*.
133-
... Choose the *Kubernetes service account* field and input *efs-csi-controller-sa*.
136+
... Choose the *Kubernetes namespace* field and input `kube-system`.
137+
... Choose the *Kubernetes service account* field and input `efs-csi-controller-sa`.
134138
... Choose *Create*.
135139
... For more information on creating Pod Identity associations, see <<pod-id-association-create>>.
136-
.. If using *IAM Roles for Service Accounts*
137-
... Choose the role in the console to open it for editing.
140+
.. If using IAM roles for service accounts:
141+
... Choose the role to open it for editing.
138142
... Choose the *Trust relationships* tab, and then choose *Edit trust policy*.
139143
... Find the line that looks similar to the following line:
140144
+
141145
[source,json,subs="verbatim,attributes"]
142146
----
143-
"oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com"
147+
"oidc.eks.region-code.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>:aud": "sts.amazonaws.com"
144148
----
145149
+
146-
Add the following line above the previous line. Replace [.replaceable]`region-code` with the {aws} Region that your cluster is in. Replace [.replaceable]`EXAMPLED539D4633E53DE1B71EXAMPLE` with your cluster's OIDC provider ID.
150+
Add the following line above the previous line. Replace `<region-code>` with the {aws} Region that your cluster is in. Replace `<EXAMPLED539D4633E53DE1B71EXAMPLE>` with your cluster's OIDC provider ID.
147151
+
148152
[source,json,subs="verbatim,attributes"]
149153
----
150-
"oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:sub": "system:serviceaccount:kube-system:efs-csi-*",
154+
"oidc.eks.<region-code>.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>:sub": "system:serviceaccount:kube-system:efs-csi-*",
151155
----
152156
... Modify the `Condition` operator from `"StringEquals"` to `"StringLike"`.
153157
... Choose *Update policy* to finish.
154158

155159

156-
=== {aws} CLI [[awscli_efs_store_app_data]]
160+
[#awscli_efs_store_app_data]
161+
=== {aws} CLI
157162
Run the following commands to create an IAM role with {aws} CLI.
158163

159-
==== If Using Pod Identities
164+
[#efs-cli-pod-identities]
165+
==== If using Pod Identities
166+
160167
. Create the IAM role that grants the `AssumeRole` and `TagSession` actions to the `pods.eks.amazonaws.com` service.
161168
+
162169
.. Copy the following contents to a file named `aws-efs-csi-driver-trust-policy-pod-identity.json`.
@@ -180,12 +187,14 @@ Run the following commands to create an IAM role with {aws} CLI.
180187
]
181188
}
182189
----
183-
.. Create the role. You can change [.replaceable]`AmazonEKS_EFS_CSI_DriverRole` to a different name, but if you do, make sure to change it in later steps too.
190+
.. Create the role. Replace `my-cluster` with your cluster name. You can also replace `AmazonEKS_EFS_CSI_DriverRole` with a different name.
184191
+
185192
[source,bash,subs="verbatim,attributes"]
186193
----
194+
export cluster_name=my-cluster
195+
export role_name=AmazonEKS_EFS_CSI_DriverRole
187196
aws iam create-role \
188-
--role-name AmazonEKS_EFS_CSI_DriverRole \
197+
--role-name $role_name \
189198
--assume-role-policy-document file://"aws-efs-csi-driver-trust-policy-pod-identity.json"
190199
----
191200
. Attach the required {aws} managed policy to the role with the following command.
@@ -194,34 +203,39 @@ aws iam create-role \
194203
----
195204
aws iam attach-role-policy \
196205
--policy-arn {arn-aws}iam::aws:policy/service-role/AmazonEFSCSIDriverPolicy \
197-
--role-name AmazonEKS_EFS_CSI_DriverRole
206+
--role-name $role_name
198207
----
199208

200-
. Run the following command to create the Pod Identity association. Replace [.replaceable]`my-cluster` with your cluster name. Replace [.replaceable]`arn:aws:iam::111122223333:role/my-role` with the role created in previous steps.
209+
. Run the following command to create the Pod Identity association. Replace `{arn-aws}iam::<111122223333>:role/my-role` with the role created in previous steps.
201210
+
202211
----
203-
aws eks create-pod-identity-association --cluster-name my-cluster --role-arn arn:aws:iam::111122223333:role/my-role --namespace kube-system --service-account efs-csi-controller-sa
212+
aws eks create-pod-identity-association --cluster-name $cluster_name --role-arn {arn-aws}iam::<111122223333>:role/my-role --namespace kube-system --service-account efs-csi-controller-sa
204213
----
205214
. For more information on creating Pod Identity associations, see <<pod-id-association-create>>.
206215

207-
==== If using IAM Roles for Service Accounts
216+
[#efs-cli-irsa]
217+
==== If using IAM roles for service accounts
208218

209-
. View your cluster's OIDC provider URL. Replace [.replaceable]`my-cluster` with your cluster name. If the output from the command is `None`, review the *Prerequisites*.
219+
. View your cluster's OIDC provider URL. Replace `my-cluster` with your cluster name. You can also replace `AmazonEKS_EFS_CSI_DriverRole` with a different name.
210220
+
211221
[source,bash,subs="verbatim,attributes"]
212222
----
213-
aws eks describe-cluster --name my-cluster --query "cluster.identity.oidc.issuer" --output text
223+
export cluster_name=my-cluster
224+
export role_name=AmazonEKS_EFS_CSI_DriverRole
225+
aws eks describe-cluster --name $cluster_name --query "cluster.identity.oidc.issuer" --output text
214226
----
215227
+
216228
An example output is as follows.
217229
+
218230
[source,bash,subs="verbatim,attributes"]
219231
----
220-
https://oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE
232+
https://oidc.eks.<region-code>.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>
221233
----
234+
+
235+
If the output from the command is `None`, review the *Prerequisites*.
222236
. Create the IAM role that grants the `AssumeRoleWithWebIdentity` action.
223237
+
224-
.. Copy the following contents to a file named `aws-efs-csi-driver-trust-policy.json`. Replace [.replaceable]`111122223333` with your account ID. Replace [.replaceable]`EXAMPLED539D4633E53DE1B71EXAMPLE` and [.replaceable]`region-code` with the values returned in the previous step.
238+
.. Copy the following contents to a file named `aws-efs-csi-driver-trust-policy.json`. Replace `<111122223333>` with your account ID. Replace `<EXAMPLED539D4633E53DE1B71EXAMPLE>` and `<region-code>` with the values returned in the previous step.
225239
+
226240
[source,json,subs="verbatim,attributes"]
227241
----
@@ -231,25 +245,25 @@ https://oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE
231245
{
232246
"Effect": "Allow",
233247
"Principal": {
234-
"Federated": "{arn-aws}iam::111122223333:oidc-provider/oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE"
248+
"Federated": "{arn-aws}iam::<111122223333>:oidc-provider/oidc.eks.<region-code>.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>"
235249
},
236250
"Action": "sts:AssumeRoleWithWebIdentity",
237251
"Condition": {
238252
"StringLike": {
239-
"oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:sub": "system:serviceaccount:kube-system:efs-csi-*",
240-
"oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com"
253+
"oidc.eks.region-code.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>:sub": "system:serviceaccount:kube-system:efs-csi-*",
254+
"oidc.eks.region-code.amazonaws.com/id/<EXAMPLED539D4633E53DE1B71EXAMPLE>:aud": "sts.amazonaws.com"
241255
}
242256
}
243257
}
244258
]
245259
}
246260
----
247-
.. Create the role. You can change [.replaceable]`AmazonEKS_EFS_CSI_DriverRole` to a different name, but if you do, make sure to change it in later steps too.
261+
.. Create the role.
248262
+
249263
[source,bash,subs="verbatim,attributes"]
250264
----
251265
aws iam create-role \
252-
--role-name AmazonEKS_EFS_CSI_DriverRole \
266+
--role-name $role_name \
253267
--assume-role-policy-document file://"aws-efs-csi-driver-trust-policy.json"
254268
----
255269
. Attach the required {aws} managed policy to the role with the following command.
@@ -258,7 +272,7 @@ aws iam create-role \
258272
----
259273
aws iam attach-role-policy \
260274
--policy-arn {arn-aws}iam::aws:policy/service-role/AmazonEFSCSIDriverPolicy \
261-
--role-name AmazonEKS_EFS_CSI_DriverRole
275+
--role-name $role_name
262276
----
263277
264278

0 commit comments

Comments
 (0)