Skip to content

Commit bdd6d0f

Browse files
authored
Merge pull request #68197 from EricPonvelle/OSDOCS-8729_AWS-Secrets-Manager-MOBB
OSDOCS-8729: Reviewed AWS Secrets Manager on ROSA migration
2 parents 4eee0c8 + 37859a6 commit bdd6d0f

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

cloud_experts_tutorials/cloud-experts-aws-secret-manager.adoc

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,50 @@ toc::[]
1717
// - Chris Kang
1818
// ---
1919

20-
The AWS Secrets and Configuration Provider (ASCP) provides a way to expose AWS Secrets as Kubernetes storage volumes. With the ASCP, you can store and manage your secrets in Secrets Manager and then retrieve them through your workloads running on ROSA.
21-
22-
This is made even easier and more secure through the use of AWS STS and Kubernetes PodIdentity.
20+
The AWS Secrets and Configuration Provider (ASCP) provides a way to expose AWS Secrets as Kubernetes storage volumes. With the ASCP, you can store and manage your secrets in Secrets Manager and then retrieve them through your workloads running on {product-title} (ROSA).
2321

2422
[id="cloud-experts-aws-secret-manager-prerequisites"]
2523
== Prerequisites
2624

25+
Ensure that you have the following resources and tools before starting this process:
26+
2727
* A ROSA cluster deployed with STS
2828
* Helm 3
29-
* aws CLI
30-
* oc CLI
31-
* jq
29+
* `aws` CLI
30+
* `oc` CLI
31+
* `jq` CLI
3232

33+
[discrete]
3334
[id="cloud-experts-aws-secret-manager-preparing-environment"]
34-
== Preparing Environment
35+
=== Additional environment requirements
3536

36-
. Validate that your cluster has STS:
37+
. Log in to your ROSA cluster by running the following command:
38+
+
39+
[source,terminal]
40+
----
41+
$ oc login --token=<your-token> --server=<your-server-url>
42+
----
43+
+
44+
You can find your login token by accessing your cluster in {cluster-manager-url-pull}.
45+
46+
. Validate that your cluster has STS by running the following command:
3747
+
3848
[source,terminal]
3949
----
4050
$ oc get authentication.config.openshift.io cluster -o json \
4151
| jq .spec.serviceAccountIssuer
4252
----
4353
+
44-
You should see something like the following, if not you should not proceed, instead look to the link:https://docs.openshift.com/rosa/rosa_getting_started_sts/rosa_creating_a_cluster_with_sts/rosa-sts-creating-a-cluster-quickly.html[Red Hat documentation on creating an STS cluster].
54+
.Example output
4555
+
4656
[source,terminal]
4757
----
4858
"https://xxxxx.cloudfront.net/xxxxx"
4959
----
60+
+
61+
If your output is different, do not proceed. See xref:../rosa_install_access_delete_clusters/rosa-sts-creating-a-cluster-quickly.adoc#rosa-sts-creating-a-cluster-quickly[Red Hat documentation on creating an STS cluster] before continuing this process.
5062

51-
. Set SecurityContextConstraints to allow the CSI driver to run:
63+
. Set the `SecurityContextConstraints` permission to allow the CSI driver to run by running the following command:
5264
+
5365
[source,terminal]
5466
----
@@ -59,7 +71,7 @@ $ oc adm policy add-scc-to-user privileged \
5971
system:serviceaccount:csi-secrets-store:csi-secrets-store-provider-aws
6072
----
6173

62-
. Create some environment variables to refer to later:
74+
. Create environment variables to use later in this process by running the following command:
6375
+
6476
[source,terminal]
6577
----
@@ -71,40 +83,40 @@ $ export AWS_PAGER=""
7183
----
7284

7385
[id="cloud-experts-aws-secret-manager-deply-aws-secrets"]
74-
== Deploy the AWS Secrets and Configuration Provider
86+
== Deploying the AWS Secrets and Configuration Provider
7587

76-
. Use Helm to register the secrets store CSI driver:
88+
. Use Helm to register the secrets store CSI driver by running the following command:
7789
+
7890
[source,terminal]
7991
----
8092
$ helm repo add secrets-store-csi-driver \
8193
https://kubernetes-sigs.github.io/secrets-store-csi-driver/charts
8294
----
8395

84-
. Update your Helm repositories:
96+
. Update your Helm repositories by running the following command:
8597
+
8698
[source,terminal]
8799
----
88100
$ helm repo update
89101
----
90102

91-
. Install the secrets store CSI driver:
103+
. Install the secrets store CSI driver by running the following command:
92104
+
93105
[source,terminal]
94106
----
95107
$ helm upgrade --install -n csi-secrets-store \
96108
csi-secrets-store-driver secrets-store-csi-driver/secrets-store-csi-driver
97109
----
98110

99-
. Deploy the AWS provider:
111+
. Deploy the AWS provider by running the following command:
100112
+
101113
[source,terminal]
102114
----
103115
$ oc -n csi-secrets-store apply -f \
104116
https://raw.githubusercontent.com/rh-mobb/documentation/main/content/misc/secrets-store-csi/aws-provider-installer.yaml
105117
----
106118

107-
. Check that both Daemonsets are running:
119+
. Check that both Daemonsets are running by running the following command:
108120
+
109121
[source,terminal]
110122
----
@@ -113,7 +125,7 @@ $ oc -n csi-secrets-store get ds \
113125
csi-secrets-store-driver-secrets-store-csi-driver
114126
----
115127

116-
. Label the Secrets Store CSI Driver to allow use with the restricted pod security profile:
128+
. Label the Secrets Store CSI Driver to allow use with the restricted pod security profile by running the following command:
117129
+
118130
[source,terminal]
119131
----
@@ -123,7 +135,7 @@ $ oc label csidriver.storage.k8s.io/secrets-store.csi.k8s.io security.openshift.
123135
[id="cloud-experts-aws-secret-manager-create-iam-polices"]
124136
== Creating a Secret and IAM Access Policies
125137

126-
. Create a secret in Secrets Manager:
138+
. Create a secret in Secrets Manager by running the following command:
127139
+
128140
[source,terminal]
129141
----
@@ -134,7 +146,7 @@ $ SECRET_ARN=$(aws --region "$REGION" secretsmanager create-secret \
134146
$ echo $SECRET_ARN
135147
----
136148

137-
. Create an IAM Access Policy document:
149+
. Create an IAM Access Policy document by running the following command:
138150
+
139151
[source,terminal]
140152
----
@@ -153,7 +165,7 @@ $ cat << EOF > policy.json
153165
EOF
154166
----
155167

156-
. Create an IAM Access Policy:
168+
. Create an IAM Access Policy by running the following command:
157169
+
158170
[source,terminal]
159171
----
@@ -164,11 +176,11 @@ $ POLICY_ARN=$(aws --region "$REGION" --query Policy.Arn \
164176
$ echo $POLICY_ARN
165177
----
166178

167-
. Create an IAM Role trust policy document:
179+
. Create an IAM Role trust policy document by running the following command:
168180
+
169181
[NOTE]
170182
====
171-
The trust policy is locked down to the default service account of a namespace you will create later.
183+
The trust policy is locked down to the default service account of a namespace you create later in this process.
172184
====
173185
+
174186
[source,terminal]
@@ -194,7 +206,7 @@ $ cat <<EOF > trust-policy.json
194206
EOF
195207
----
196208

197-
. Create an IAM role:
209+
. Create an IAM role by running the following command:
198210
+
199211
[source,terminal]
200212
----
@@ -204,7 +216,7 @@ $ ROLE_ARN=$(aws iam create-role --role-name openshift-access-to-mysecret \
204216
$ echo $ROLE_ARN
205217
----
206218

207-
. Attach the role to the policy:
219+
. Attach the role to the policy by running the following command:
208220
+
209221
[source,terminal]
210222
----
@@ -215,22 +227,22 @@ $ aws iam attach-role-policy --role-name openshift-access-to-mysecret \
215227
[id="cloud-experts-aws-secret-manager-creating-application"]
216228
== Create an Application to use this secret
217229

218-
. Create an OpenShift project:
230+
. Create an OpenShift project by running the following command:
219231
+
220232
[source,terminal]
221233
----
222234
$ oc new-project my-application
223235
----
224236

225-
. Annotate the default service account to use the STS Role:
237+
. Annotate the default service account to use the STS Role by running the following command:
226238
+
227239
[source,terminal]
228240
----
229241
$ oc annotate -n my-application serviceaccount default \
230242
eks.amazonaws.com/role-arn=$ROLE_ARN
231243
----
232244

233-
. Create a secret provider class to access our secret:
245+
. Create a secret provider class to access our secret by running the following command:
234246
+
235247
[source,terminal]
236248
----
@@ -248,7 +260,7 @@ spec:
248260
EOF
249261
----
250262

251-
. Create a Deployment using our secret:
263+
. Create a Deployment by using our secret in the following command:
252264
+
253265
[source,terminal]
254266
----
@@ -280,7 +292,7 @@ spec:
280292
EOF
281293
----
282294

283-
. Verify the Pod has the secret mounted:
295+
. Verify the Pod has the secret mounted by running the following commandv:
284296
+
285297
[source,terminal]
286298
----
@@ -290,21 +302,21 @@ $ oc exec -it my-application -- cat /mnt/secrets-store/MySecret
290302
[id="cloud-experts-aws-secret-manager-cleanup"]
291303
== Clean up
292304

293-
. Delete the application:
305+
. Delete the application by running the following command:
294306
+
295307
[source,terminal]
296308
----
297309
$ oc delete project my-application
298310
----
299311

300-
. Delete the secrets store csi driver:
312+
. Delete the secrets store csi driver by running the following command:
301313
+
302314
[source,terminal]
303315
----
304316
$ helm delete -n csi-secrets-store csi-secrets-store-driver
305317
----
306318

307-
. Delete Security Context Constraints:
319+
. Delete Security Context Constraints by running the following command:
308320
+
309321
[source,terminal]
310322
----
@@ -314,15 +326,15 @@ $ oc adm policy remove-scc-from-user privileged \
314326
system:serviceaccount:csi-secrets-store:csi-secrets-store-provider-aws
315327
----
316328

317-
. Delete the AWS provider:
329+
. Delete the AWS provider by running the following command:
318330
+
319331
[source,terminal]
320332
----
321333
$ oc -n csi-secrets-store delete -f \
322334
https://raw.githubusercontent.com/rh-mobb/documentation/main/content/misc/secrets-store-csi/aws-provider-installer.yaml
323335
----
324336

325-
. Delete AWS Roles and Policies:
337+
. Delete AWS Roles and Policies by running the following command:
326338
+
327339
[source,terminal]
328340
----
@@ -332,7 +344,7 @@ $ aws iam delete-role --role-name openshift-access-to-mysecret
332344
$ aws iam delete-policy --policy-arn $POLICY_ARN
333345
----
334346

335-
. Delete the Secrets Manager secret:
347+
. Delete the Secrets Manager secret by running the following command:
336348
+
337349
[source,terminal]
338350
----

0 commit comments

Comments
 (0)