Skip to content

Commit 33840c3

Browse files
authored
Merge pull request #67957 from fmcdonal/OSDOCS-5590
[OSDOCS 5590]: Creating an AWS KMS key for customer encryption
2 parents 7fdafa6 + 998da56 commit 33840c3

6 files changed

+291
-15
lines changed

_topic_maps/_topic_map_rosa.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ Distros: openshift-rosa
172172
Topics:
173173
- Name: Creating ROSA with HCP clusters using the default options
174174
File: rosa-hcp-sts-creating-a-cluster-quickly
175+
- Name: Creating ROSA with HCP clusters using a custom AWS KMS encryption key
176+
File: rosa-hcp-creating-cluster-with-aws-kms-key
175177
- Name: Using the Node Tuning Operator on ROSA with HCP
176178
File: rosa-tuning-config
177179
---
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/enabling-monitoring-for-user-defined-projects.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="creating-cluster-with-aws-kms-key"]
7+
= Creating a ROSA cluster using a custom AWS KMS key
8+
9+
You can create a {product-title} (ROSA) cluster with a customer-provided KMS key that is used to encrypt either node root volumes, the etcd database, or both. A different KMS key ARN can be provided for each option.
10+
11+
[NOTE]
12+
====
13+
{hcp-title} does not automatically configure the `default` storage class to encrypt persistent volumes with the customer-provided KMS key. This is something that can be configured in-cluster after installation.
14+
====
15+
16+
17+
.Procedure
18+
19+
. Create a custom AWS customer-managed KMS key by running the following command:
20+
+
21+
[source,terminal]
22+
----
23+
$ KMS_ARN=$(aws kms create-key --region $AWS_REGION --description 'Custom ROSA Encryption Key' --tags TagKey=red-hat,TagValue=true --query KeyMetadata.Arn --output text)
24+
----
25+
+
26+
This command saves the Amazon Resource Name (ARN) output of this custom key for further steps.
27+
+
28+
[NOTE]
29+
====
30+
Customers must provide the `--tags TagKey=red-hat,TagValue=true` argument that is required for a customer KMS key.
31+
====
32+
33+
34+
. Verify the KMS key has been created by running the following command:
35+
+
36+
[source,terminal]
37+
----
38+
$ echo $KMS_ARN
39+
----
40+
41+
. Set your AWS account ID to an environment variable.
42+
+
43+
[source,terminal]
44+
----
45+
$ AWS_ACCOUNT_ID=<aws_account_id>
46+
----
47+
. Add the ARN for the account-wide installer role and operator roles that you created in the preceding step to the `Statement.Principal.AWS` section in the file. In the following example, the ARN for the default `ManagedOpenShift-HCP-ROSA-Installer-Role` role is added:
48+
49+
+
50+
[source,terminal]
51+
----
52+
{
53+
"Version": "2012-10-17",
54+
"Id": "key-rosa-policy-1",
55+
"Statement": [
56+
{
57+
"Sid": "Enable IAM User Permissions",
58+
"Effect": "Allow",
59+
"Principal": {
60+
"AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:root"
61+
},
62+
"Action": "kms:*",
63+
"Resource": "*"
64+
},
65+
{
66+
"Sid": "Installer Permissions",
67+
"Effect": "Allow",
68+
"Principal": {
69+
"AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ManagedOpenShift-HCP-ROSA-Installer-Role"
70+
},
71+
"Action": [
72+
"kms:CreateGrant",
73+
"kms:DescribeKey",
74+
"kms:GenerateDataKeyWithoutPlaintext"
75+
],
76+
"Resource": "*"
77+
},
78+
{
79+
"Sid": "ROSA KubeControllerManager Permissions",
80+
"Effect": "Allow",
81+
"Principal": {
82+
"AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/<operator_role_prefix>-kube-system-kube-controller-manager"
83+
84+
},
85+
"Action": "kms:DescribeKey",
86+
"Resource": "*"
87+
},
88+
{
89+
"Sid": "ROSA KMS Provider Permissions",
90+
"Effect": "Allow",
91+
"Principal": {
92+
"AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/<operator_role_prefix>-kube-system-kms-provider"
93+
},
94+
"Action": [
95+
"kms:Encrypt",
96+
"kms:Decrypt",
97+
"kms:DescribeKey"
98+
],
99+
"Resource": "*"
100+
},
101+
{
102+
"Sid": "ROSA NodeManager Permissions",
103+
"Effect": "Allow",
104+
"Principal": {
105+
"AWS": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/<operator_role_prefix>-kube-system-capa-controller-manager"
106+
},
107+
"Action": [
108+
"kms:DescribeKey",
109+
"kms:GenerateDataKeyWithoutPlaintext",
110+
"kms:CreateGrant"
111+
],
112+
"Resource": "*"
113+
}
114+
]
115+
}
116+
----
117+
118+
. Confirm the details of the policy file created by running the following command:
119+
+
120+
[source,terminal]
121+
----
122+
$ cat rosa-key-policy.json
123+
----
124+
125+
. Apply the newly generated key policy to the custom KMS key by running the following command:
126+
127+
+
128+
[source,terminal]
129+
----
130+
$ aws kms put-key-policy --key-id $KMS_ARN \
131+
--policy file://rosa-key-policy.json \
132+
--policy-name default
133+
----
134+
135+
. Create the cluster by running the following command:
136+
137+
+
138+
[source,terminal]
139+
----
140+
$ rosa create cluster --cluster-name <cluster_name> \
141+
--subnet-ids <private_subnet_id>,<public_subnet_id> \
142+
--sts \
143+
--mode auto \
144+
--machine-cidr 10.0.0.0/16 \
145+
--compute-machine-type m5.xlarge \
146+
--hosted-cp \
147+
--region <aws_region> \
148+
--oidc-config-id $OIDC_ID \
149+
--kms-key-arn $KMS_ARN \ <1>
150+
--etcd-encryption-kms-arn $KMS_ARN \ <2>
151+
--operator-roles-prefix $OPERATOR_ROLES_PREFIX
152+
----
153+
<1> This KMS key ARN is used to encrypt all worker node root volumes. It is not required if only etcd database encryption is needed.
154+
<2> This KMS key ARN is used to encrypt the etcd database. The etcd database is always encrypted by default with an AES cipher block, but can be encrypted instead with a KMS key. It is not required if only node root volume encryption is needed.
155+
156+
.Verification
157+
158+
You can verify that your KMS key works by using {cluster-manager-url}.
159+
160+
. Navigate to {cluster-manager-url} and select *Instances*.
161+
162+
. Select your instance.
163+
164+
. Click the *Storage* tab.
165+
166+
. Copy the *KMS key ID*.
167+
168+
. Search and select *Key Management Service*.
169+
170+
. Enter your copied _KMS key ID_ in the *Filter* field.

modules/rosa-hcp-creating-account-wide-sts-roles-and-policies.adoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[id="rosa-sts-creating-account-wide-sts-roles-and-policies_{context}"]
44
= Creating the account-wide STS roles and policies
55

6-
Before using the {product-title} (ROSA) CLI, `rosa`, to create {hcp-title-first} clusters, create the required account-wide roles and policies, including the Operator policies.
6+
Before using the {product-title} (ROSA) CLI (`rosa`) to create {hcp-title-first} clusters, create the required account-wide roles and policies, including the Operator policies.
77

88
[NOTE]
99
====
@@ -20,9 +20,21 @@ Before using the {product-title} (ROSA) CLI, `rosa`, to create {hcp-title-first}
2020
2121
.Procedure
2222

23-
. If they do not exist in your AWS account, create the required account-wide STS roles and attach the policies by running the following command:
23+
* If they do not exist in your AWS account, create the required account-wide STS roles and attach the policies by running the following command:
2424
+
2525
[source,terminal]
2626
----
2727
$ rosa create account-roles --hosted-cp
28-
----
28+
----
29+
+
30+
[source,terminal]
31+
----
32+
$ ACCOUNT_ROLES_PREFIX="${ACCOUNT_ROLES_PREFIX}"
33+
----
34+
+
35+
[source,terminal]
36+
----
37+
$ rosa create account-roles --hosted-cp --prefix $ACCOUNT_ROLES_PREFIX
38+
----
39+
+
40+
For more information regarding AWS managed IAM policies for ROSA, see link:https://docs.aws.amazon.com/ROSA/latest/userguide/security-iam-awsmanpol.html[AWS managed IAM policies for ROSA].

modules/rosa-operator-config.adoc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
12
// Module included in the following assemblies:
23
//
34
// * rosa_hcp/rosa-hcp-sts-creating-a-cluster-quickly.adoc
45

5-
:_mod-docs-content-type: PROCEDURE
6+
:_content-type: PROCEDURE
67
[id="rosa-operator-config_{context}"]
78
= Creating Operator roles and policies
89

@@ -11,30 +12,39 @@ When using a {hcp-title} cluster, you must create the Operator IAM roles that ar
1112
.Prerequisites
1213

1314
* You have completed the AWS prerequisites for {hcp-title}.
14-
* You have installed and configured the latest {product-title} (ROSA) CLI, `rosa`, on your installation host.
15+
* You have installed and configured the latest {product-title} ROSA CLI (`rosa`), on your installation host.
1516
* You created the account-wide AWS roles.
1617
1718
.Procedure
1819

19-
* To create your Operator roles, run the following command:
20+
. Set your prefix name to an environment variable using the following command:
2021
+
2122
[source,terminal]
2223
----
23-
$ rosa create operator-roles --hosted-cp --prefix <prefix-name> --oidc-config-id <oidc-config-id>
24+
$ OPERATOR_ROLES_PREFIX=<prefix_name>
25+
----
26+
. To create your Operator roles, run the following command:
27+
28+
+
29+
[source,terminal]
30+
----
31+
$ rosa create operator-roles --hosted-cp --prefix $OPERATOR_ROLES_PREFIX --oidc-config-id $OIDC_ID --installer-role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/${ACCOUNT_ROLES_PREFIX}-HCP-ROSA-Installer-Role
2432
----
2533
+
2634
The following breakdown provides options for the Operator role creation.
2735
+
2836
[source,terminal]
2937
----
3038
$ rosa create operator-roles --hosted-cp
31-
--prefix <prefix-name> <1>
32-
--oidc-config-id <oidc-config-id> <2>
39+
--prefix $OPERATOR_ROLES_PREFIX <1>
40+
--oidc-config-id $OIDC_ID <2>
41+
--installer-role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/${ACCOUNT_ROLES_PREFIX}-HCP-ROSA-Installer-Role <3>
3342
----
3443
+
3544
--
3645
<1> You must supply a prefix when creating these Operator roles. Failing to do so produces an error. See the Additional resources of this section for information on the Operator prefix.
3746
<2> This value is the OIDC configuration ID that you created for your {hcp-title} cluster.
47+
<3> This value is the installer role ARN that you created when you created the ROSA account roles.
3848
--
3949
+
4050
You must include the `--hosted-cp` parameter to create the correct roles for {hcp-title} clusters. This command returns the following information.
@@ -48,7 +58,7 @@ You must include the `--hosted-cp` parameter to create the correct roles for {hc
4858
? OIDC Configuration ID: 23soa2bgvpek9kmes9s7os0a39i13qm4 | https://dvbwgdztaeq9o.cloudfront.net/23soa2bgvpek9kmes9s7os0a39i13qm4 <2>
4959
? Create hosted control plane operator roles: Yes
5060
W: More than one Installer role found
51-
? Installer role ARN: arn:aws:iam::4540112244:role/<prefix>-Installer-Role
61+
? Installer role ARN: arn:aws:iam::4540112244:role/<prefix>-HCP-ROSA-Installer-Role
5262
? Permissions boundary ARN (optional):
5363
I: Reusable OIDC Configuration detected. Validating trusted relationships to operator roles:
5464
I: Creating roles using 'arn:aws:iam::4540112244:user/<userName>'
@@ -65,15 +75,15 @@ I: To create a cluster with these roles, run the following command:
6575
----
6676
+
6777
--
68-
<1> This field is prefilled with the prefix that you set in the initial creation command.
78+
<1> This field is prepopulated with the prefix that you set in the initial creation command.
6979
<2> This field requires you to select an OIDC configuration that you created for your {hcp-title} cluster.
7080
--
7181
+
7282
The Operator roles are now created and ready to use for creating your {hcp-title} cluster.
7383

7484
.Verification
7585

76-
. You can list the Operator roles associated with your ROSA account. Run the following command:
86+
* You can list the Operator roles associated with your ROSA account. Run the following command:
7787
+
7888
[source,terminal]
7989
----
@@ -102,4 +112,4 @@ ROLE NAME ROLE ARN
102112
+
103113
--
104114
<1> After the command runs, it displays all the prefixes associated with your AWS account and notes how many roles are associated with this prefix. If you need to see all of these roles and their details, enter "Yes" on the detail prompt to have these roles listed out with specifics.
105-
--
115+
--

modules/rosa-sts-byo-oidc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $ 30f5dqmk
8383

8484
.Verification
8585

86-
. You can list the possible OIDC configurations available for your clusters that are associated with your user organization. Run the following command:
86+
* You can list the possible OIDC configurations available for your clusters that are associated with your user organization. Run the following command:
8787
+
8888
[source,terminal]
8989
----
@@ -98,4 +98,4 @@ ID MANAGED ISSUER URL
9898
2330dbs0n8m3chkkr25gkkcd8pnj3lk2 true https://dvbwgdztaeq9o.cloudfront.net/2330dbs0n8m3chkkr25gkkcd8pnj3lk2
9999
233hvnrjoqu14jltk6lhbhf2tj11f8un false https://oidc-r7u1.s3.us-east-1.amazonaws.com aws:secretsmanager:us-east-1:242819244:secret:rosa-private-key-oidc-r7u1-tM3MDN
100100
101-
----
101+
----

0 commit comments

Comments
 (0)