Skip to content

Commit 9242283

Browse files
authored
Merge pull request #81456 from EricPonvelle/OSDOCS-10249_Zero-Public-Egress
OSDOCS#10249: Drafted docs for creating a cluster with egress lockdown
2 parents dafb5a4 + 1fb8ff3 commit 9242283

8 files changed

+323
-8
lines changed

_topic_maps/_topic_map_rosa_hcp.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
#
2121
# The ordering of the records in this document determines the ordering of the
2222
# topic groups and topics on the main page.
23-
23+
---
24+
Name: What's new
25+
Dir: rosa_release_notes
26+
Distros: openshift-rosa-hcp
27+
Topics:
28+
- Name: What's new with Red Hat OpenShift Service on AWS
29+
File: rosa-release-notes
2430
---
2531
Name: Introduction to ROSA
2632
Dir: rosa_architecture
@@ -203,6 +209,8 @@ Topics:
203209
File: rosa-hcp-creating-cluster-with-aws-kms-key
204210
- Name: Creating a private cluster on ROSA with HCP
205211
File: rosa-hcp-aws-private-creating-cluster
212+
- Name: Creating a ROSA with HCP cluster with egress lockdown
213+
File: rosa-hcp-egress-lockdown-install
206214
- Name: Creating ROSA with HCP clusters with external authentication
207215
File: rosa-hcp-sts-creating-a-cluster-ext-auth
208216
---
@@ -234,8 +242,6 @@ Topics:
234242
File: dedicated-aws-vpn
235243
- Name: Configuring AWS Direct Connect
236244
File: dedicated-aws-dc
237-
# - Name: Cluster autoscaling # Cluster autoscaling not supported on HCP
238-
# File: rosa-cluster-autoscaling
239245
- Name: Manage nodes using machine pools
240246
Dir: rosa_nodes
241247
Topics:

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
// * rosa_hcp/rosa-hcp-sts-creating-a-cluster-quickly.adoc
2+
3+
4+
ifeval::["{context}" == "rosa-hcp-egress-lockdown-install"]
5+
:egress-lockdown:
6+
endif::[]
7+
28
:_mod-docs-content-type: PROCEDURE
39
[id="rosa-sts-creating-account-wide-sts-roles-and-policies_{context}"]
410
= Creating the account-wide STS roles and policies
@@ -27,6 +33,18 @@ Before using the {product-title} (ROSA) CLI (`rosa`) to create {hcp-title-first}
2733
$ rosa create account-roles --hosted-cp
2834
----
2935

36+
ifdef::egress-lockdown[]
37+
. Ensure that the your worker role has the correct AWS policy by running the following command:
38+
+
39+
[source,terminal]
40+
----
41+
$ aws iam attach-role-policy \
42+
--role-name ManagedOpenShift-HCP-ROSA-Worker-Role \ <1>
43+
--policy-arn "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
44+
----
45+
<1> This role needs to include the prefix that was created in the previous step.
46+
endif::egress-lockdown[]
47+
3048
. Optional: Set your prefix as an environmental variable by running the following command:
3149
+
3250
[source,terminal]
@@ -48,4 +66,8 @@ $ echo $ACCOUNT_ROLES_PREFIX
4866
ManagedOpenShift
4967
----
5068

51-
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].
69+
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].
70+
71+
ifeval::["{context}" == "rosa-hcp-egress-lockdown-install"]
72+
:!egress-lockdown:
73+
endif::[]

modules/rosa-hcp-sgs-and-vpce.adoc

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * rosa_hcp/rosa-hcp-sts-creating-a-cluster-quickly.adoc
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="rosa-hcp-sgs-and-vpce_{context}"]
6+
= Configuring AWS security groups and PrivateLink connections
7+
8+
After creating your VPC, create your AWS security groups and VPC endpoints.
9+
10+
.Procedure
11+
12+
. Create the AWS security group by running the following command:
13+
+
14+
[source,terminal]
15+
----
16+
$ aws ec2 create-security-group \
17+
--group-name allow-inbound-traffic \
18+
--description "allow inbound traffic" \
19+
--vpc-id <vpc_id> \ <1>
20+
--region <aws_region> \ <2>
21+
----
22+
<1> Enter your VPC's ID.
23+
<2> Enter the AWS region where the VPC was installed.
24+
25+
. Grant access to the security group's ingress by running the following command:
26+
+
27+
[source,terminal]
28+
----
29+
$ aws ec2 authorize-security-group-ingress \
30+
--group-id <group_id> \ <1>
31+
--protocol -1 \
32+
--port 0-0 \
33+
--cidr <vpc_cidr> \ <2>
34+
--region <aws_region> \ <3>
35+
----
36+
<1> `--group-id` uses ID of the security group created with the previous command.
37+
<2> Enter the CIDR of your VPC.
38+
<3> The AWS region where you installed your VPC
39+
40+
. Create your STS VPC endpoint by running the following command:
41+
+
42+
[source,terminal]
43+
----
44+
$ aws ec2 create-vpc-endpoint \
45+
--vpc-id <vpc_id> \ <1>
46+
--service-name com.amazonaws.<aws_region>.sts \ <2>
47+
--vpc-endpoint-type Interface
48+
----
49+
<1> Enter your VPC's ID.
50+
<2> Enter the AWS region where the VPC was installed.
51+
52+
. Create your ECR VPC endpoints by running the following command:
53+
+
54+
[source,terminal]
55+
----
56+
$ aws ec2 create-vpc-endpoint \
57+
--vpc-id <vpc_id> \
58+
--service-name com.amazonaws.<aws_region>.ecr.dkr \ <1>
59+
--vpc-endpoint-type Interface
60+
----
61+
<1> Enter the AWS region where the VPC is located.
62+
63+
. Create your S3 VPC endpoint by running the following command:
64+
+
65+
[source,terminal]
66+
----
67+
$ aws ec2 create-vpc-endpoint \
68+
--vpc-id <vpc_id> \
69+
--service-name com.amazonaws.<aws_region>.s3
70+
----
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * rosa_hcp/rosa-hcp-disconnected-install.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="rosa-hcp-sts-creating-a-cluster-egress-lockdown-cli_{context}"]
7+
= Creating a {hcp-title} cluster with egress lockdown using the CLI
8+
9+
When using the {product-title} (ROSA) command-line interface (CLI), `rosa`, to create a cluster, you can select the default options to create the cluster quickly.
10+
11+
.Prerequisites
12+
13+
* You have completed the AWS prerequisites for {hcp-title}.
14+
* You have available AWS service quotas.
15+
* You have enabled the ROSA service in the AWS Console.
16+
* You have installed and configured the latest ROSA CLI (`rosa`) on your installation host. Run `rosa version` to see your currently installed version of the ROSA CLI. If a newer version is available, the CLI provides a link to download this upgrade.
17+
* You have logged in to your Red{nbsp}Hat account by using the ROSA CLI.
18+
* You have created an OIDC configuration.
19+
* You have verified that the AWS Elastic Load Balancing (ELB) service role exists in your AWS account.
20+
21+
.Procedure
22+
23+
. Use one of the following commands to create your {hcp-title} cluster:
24+
+
25+
[NOTE]
26+
====
27+
When creating a {hcp-title} cluster, the default machine Classless Inter-Domain Routing (CIDR) is `10.0.0.0/16`. If this does not correspond to the CIDR range for your VPC subnets, add `--machine-cidr <address_block>` to the following commands. To learn more about the default CIDR ranges for {product-title}, see the CIDR range definitions.
28+
====
29+
+
30+
* If you did not set environment variables, run the following command:
31+
+
32+
[source,terminal]
33+
----
34+
$ rosa create cluster --cluster-name=<cluster_name> \ <.>
35+
--mode=auto --hosted-cp [--private] \ <.>
36+
--operator-roles-prefix <operator-role-prefix> \ <.>
37+
--oidc-config-id <id-of-oidc-configuration> \
38+
--subnet-ids=<private-subnet-id> --region <region> \
39+
--machine-cidr 10.0.0.0/16 --service-cidr 172.30.0.0/16 \
40+
--pod-cidr 10.128.0.0/14 --host-prefix 23 \
41+
--billing-account <root-acct-id> \ <.>
42+
--properties zero_egress:true
43+
----
44+
+
45+
--
46+
<.> Specify the name of your cluster. If your cluster name is longer than 15 characters, it will contain an autogenerated domain prefix as a subdomain for your provisioned cluster on openshiftapps.com. To customize the subdomain, use the `--domain-prefix` flag. The domain prefix cannot be longer than 15 characters, must be unique, and cannot be changed after cluster creation.
47+
<.> By default, the cluster-specific Operator role names are prefixed with the cluster name and a random 4-digit hash. You can optionally specify a custom prefix to replace `<cluster_name>-<hash>` in the role names. The prefix is applied when you create the cluster-specific Operator IAM roles. For information about the prefix, see _About custom Operator IAM role prefixes_.
48+
+
49+
[NOTE]
50+
====
51+
If you specified custom ARN paths when you created the associated account-wide roles, the custom path is automatically detected. The custom path is applied to the cluster-specific Operator roles when you create them in a later step.
52+
====
53+
<.> Provide the AWS account that is responsible for all billing.
54+
--
55+
56+
* If you set the environment variables, create a cluster with egress lockdown that has a single, initial machine pool, using a privately available API, and a privately available Ingress by running the following command:
57+
+
58+
[source,terminal]
59+
----
60+
$ rosa create cluster --private --cluster-name=<cluster_name> \
61+
--mode=auto --hosted-cp --operator-roles-prefix=$OPERATOR_ROLES_PREFIX \
62+
--oidc-config-id=$OIDC_ID --subnet-ids=$SUBNET_IDS \
63+
--region <region> --machine-cidr 10.0.0.0/16 --service-cidr 172.30.0.0/16 \
64+
--pod-cidr 10.128.0.0/14 --host-prefix 23 --billing-account <root-acct-id> \
65+
--private --properties zero_egress:true
66+
----
67+
+
68+
. Check the status of your cluster by running the following command:
69+
+
70+
[source,terminal]
71+
----
72+
$ rosa describe cluster --cluster=<cluster_name>
73+
----
74+
+
75+
The following `State` field changes are listed in the output as cluster installation progresses:
76+
+
77+
* `pending (Preparing account)`
78+
* `installing (DNS setup in progress)`
79+
* `installing`
80+
* `ready`
81+
+
82+
[NOTE]
83+
====
84+
If the installation fails or the `State` field does not change to `ready` after more than 10 minutes, check the installation troubleshooting documentation for details. For more information, see _Troubleshooting installations_. For steps to contact Red{nbsp}Hat Support for assistance, see _Getting support for Red{nbsp}Hat OpenShift Service on AWS_.
85+
====
86+
+
87+
. Track the cluster creation progress by watching the {product-title} installation program logs. To check the logs, run the following command:
88+
+
89+
[source,terminal]
90+
----
91+
$ rosa logs install --cluster=<cluster_name> --watch \ <.>
92+
----
93+
<.> Optional: To watch for new log messages as the installation progresses, use the `--watch` argument.

modules/rosa-hcp-vpc-subnet-tagging.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ You must tag at least one private subnet and, if applicable, and one public subn
4040
+
4141
[source,terminal]
4242
----
43-
$ aws ec2 create-tags --resources <public-subnet-id> --tags Key=kubernetes.io/role/elb,Value=1
43+
$ aws ec2 create-tags --resources <public-subnet-id> --region <aws_region> --tags Key=kubernetes.io/role/elb,Value=1
4444
----
4545
.. For private subnets, run:
4646
+
4747
[source,terminal]
4848
----
49-
$ aws ec2 create-tags --resources <private-subnet-id> --tags Key=kubernetes.io/role/internal-elb,Value=1
49+
$ aws ec2 create-tags --resources <private-subnet-id> --region <aws_region> --tags Key=kubernetes.io/role/internal-elb,Value=1
5050
----
5151

5252
.Verification

modules/rosa-hcp-vpc-terraform.adoc

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
//
33
// * rosa_hcp/rosa-hcp-sts-creating-a-cluster-quickly.adoc
44

5+
ifeval::["{context}" == "rosa-hcp-egress-lockdown-install"]
6+
:egress-lockdown-rosa:
7+
endif::[]
8+
59
:_mod-docs-content-type: PROCEDURE
610
[id="rosa-hcp-vpc-terraform_{context}"]
711
= Creating a Virtual Private Cloud using Terraform
@@ -23,11 +27,20 @@ $ git clone https://github.com/openshift-cs/terraform-vpc-example
2327
----
2428

2529
. Navigate to the created directory by running the following command:
30+
ifndef::egress-lockdown-rosa[]
2631
+
2732
[source,terminal]
2833
----
2934
$ cd terraform-vpc-example
3035
----
36+
endif::egress-lockdown-rosa[]
37+
ifdef::egress-lockdown-rosa[]
38+
+
39+
[source,terminal]
40+
----
41+
$ cd terraform-vpc-example/zero-egress
42+
----
43+
endif::egress-lockdown-rosa[]
3144

3245
. Initiate the Terraform file by running the following command:
3346
+
@@ -38,14 +51,42 @@ $ terraform init
3851
+
3952
A message confirming the initialization appears when this process completes.
4053

54+
ifdef::egress-lockdown-rosa[]
55+
. To build your VPC Terraform plan based on the existing Terraform template, run the `plan` command. You must include your AWS region, availability zones, CIDR blocks, and private subnets. You can choose to specify a cluster name. A `rosa-zero-egress.tfplan` file is added to the `hypershift-tf` directory after the `terraform plan` completes. For more detailed options, see the link:https://github.com/openshift-cs/terraform-vpc-example/blob/main/README.md[Terraform VPC repository's README file].
56+
+
57+
[source,terminal]
58+
----
59+
$ terraform plan -out rosa-zero-egress.tfplan -var region=<aws_region> \ <1>
60+
-var 'availability_zones=["aws_region_1a","aws_region_1b","aws_region_1c"]'\ <2>
61+
-var vpc_cidr_block=10.0.0.0/16 \ <3>
62+
-var 'private_subnets=["10.0.0.0/24", "10.0.1.0/24", "10.0.2.0/24"]' <4>
63+
----
64+
+
65+
--
66+
<1> Enter your AWS region.
67+
<2> Enter the availability zones for the VPC. For example, for a VPC that uses `ap-southeast-1`, you would use the following as availability zones: `["ap-southeast-1a", "ap-southeast-1b", "ap-southeast-1c"]`.
68+
<3> Enter the CIDR block for your VPC.
69+
<4> Enter each of the subnets that are created for the VPC.
70+
--
71+
endif::egress-lockdown-rosa[]
72+
ifndef::egress-lockdown-rosa[]
4173
. To build your VPC Terraform plan based on the existing Terraform template, run the `plan` command. You must include your AWS region. You can choose to specify a cluster name. A `rosa.tfplan` file is added to the `hypershift-tf` directory after the `terraform plan` completes. For more detailed options, see the link:https://github.com/openshift-cs/terraform-vpc-example/blob/main/README.md[Terraform VPC repository's README file].
4274
+
4375
[source,terminal]
4476
----
4577
$ terraform plan -out rosa.tfplan -var region=<region>
4678
----
79+
endif::egress-lockdown-rosa[]
4780

4881
. Apply this plan file to build your VPC by running the following command:
82+
ifdef::egress-lockdown-rosa[]
83+
+
84+
[source,terminal]
85+
----
86+
$ terraform apply rosa-zero-egress.tfplan
87+
----
88+
endif::egress-lockdown-rosa[]
89+
ifndef::egress-lockdown-rosa[]
4990
+
5091
[source,terminal]
5192
----
@@ -71,4 +112,9 @@ $ echo $SUBNET_IDS
71112
[source,terminal]
72113
----
73114
$ subnet-0a6a57e0f784171aa,subnet-078e84e5b10ecf5b0
74-
----
115+
----
116+
endif::egress-lockdown-rosa[]
117+
118+
ifeval::["{context}" == "rosa-hcp-egress-lockdown-install"]
119+
:!egress-lockdown-rosa:
120+
endif::[]

0 commit comments

Comments
 (0)