Creating ROSA with HCP clusters using the default options
Red Hat® OpenShift® Service on AWS (ROSA) with hosted control planes (HCP) offers a more efficient and reliable architecture for creating ROSA clusters. With ROSA with HCP, each cluster has a dedicated control plane that is isolated in a ROSA service account.
Create a ROSA with HCP cluster quickly by using the default options and automatic AWS Identity and Access Management (IAM) resource creation. You can deploy your cluster by using the ROSA CLI (rosa
).
Note: Since it is not possible to upgrade or convert existing ROSA clusters to a hosted control planes architecture, you must create a new cluster to use ROSA with HCP functionality.
Note: Sharing VPCs across multiple AWS accounts is not currently supported for ROSA with HCP. Do not install a ROSA with HCP cluster into subnets shared from another AWS account. See "Are multiple ROSA clusters in a single VPC supported?" for more information.
After reading this resource, you will know:
- How to create a Virtual Private Cloud for your ROSA with HCP clusters
- How to create a ROSA with HCP cluster using the CLI
- Other options for creating ROSA with HCP clusters
You can quickly create a ROSA with HCP cluster with the Security Token Service (STS) by using the default installation options. View this summary to describe the default cluster specifications.
ROSA with HCP prerequisites
To create a ROSA with HCP cluster, you must have the following items:
- A configured virtual private cloud (VPC)
- Account-wide roles
- An OIDC configuration
- Operator roles
Creating a Virtual Private Cloud for your ROSA with HCP clusters
You must have a Virtual Private Cloud (VPC) to create ROSA with HCP cluster. You can use the following methods to create a VPC:
- Create a VPC by using a Terraform template
- Manually create the VPC resources in the AWS console
Note: The Terraform instructions are for testing and demonstration purposes. Your own installation requires some modifications to the VPC for your own use. You should also ensure that when you use this Terraform script it is in the same region that you intend to install your cluster. In these examples, use us-east-2
.
Creating a Virtual Private Cloud using Terraform
Terraform is a tool that allows you to create various resources using an established template. The following process uses the default options as required to create a ROSA with HCP cluster. For more information about using Terraform, see the additional resources.
Prerequisites:
- You have installed Terraform version 1.4.0 or newer on your machine.
- You have installed Git on your machine.
Steps:
- Open a shell prompt and clone the Terraform VPC repository by running the following command:
git clone https://github.com/openshift-cs/terraform-vpc-example
- Navigate to the created directory by running the following command:
cd terraform-vpc-example
Initiate the Terraform file by running the following command:
terraform init
A message confirming the initialization appears when this process completes.
- 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 thehypershift-tf
directory after theterraform plan
completes. For more detailed options, see the Terraform VPC repository’s README file.terraform plan -out rosa.tfplan -var region=<region>
- Apply this plan file to build your VPC by running the following command:
terraform apply rosa.tfplan
- Optional: You can capture the values of the Terraform-provisioned private, public, and machinepool subnet IDs as environment variables to use when creating your ROSA with HCP cluster by running the following commands:
export SUBNET_IDS=$(terraform output -raw cluster-subnets-string)
- Verify that the variables were correctly set with the following command:
echo $SUBNET_IDS
- Optional: You can capture the values of the Terraform-provisioned private, public, and machinepool subnet IDs as environment variables to use when creating your ROSA with HCP cluster by running the following commands:
Note: See the Terraform VPC repository for a detailed list of all options available when customizing the VPC for your needs.
Creating a Virtual Private Cloud manually
If you choose to manually create your Virtual Private Cloud (VPC) instead of using Terraform, go to the VPC page in the AWS console.
Before you can use your VPC to create a ROSA with HCP cluster, you must tag your VPC subnets. Automated service preflight checks verify that these resources are tagged correctly before you can use these resources. The following table shows how your resources should be tagged as the following:
Resource | Key | Value |
Public subnet | kubernetes.io/role/elb | 1 or no value |
Public subnet | kubernetes.io/role/internal-elb | 1 or no value |
Note: You must tag at least one private subnet and, if applicable, and one public subnet.
Prerequisites:
- You have created a VPC.
- You have installed the aws CLI.
Steps:
- Tag your resources in your terminal by running the following commands:
- For public subnets, run:
aws ec2 create-tags --resources <public-subnet-id> --tags Key=kubernetes.io/role/elb,Value=1
- For private subnets, run:
aws ec2 create-tags --resources <private-subnet-id> --tags Key=kubernetes.io/role/internal-elb,Value=1
- For public subnets, run:
- Verify that the tag is correctly applied by running the following command:
aws ec2 describe-tags --filters "Name=resource-id,Values=<subnet_id>"
- Example output:
TAGS Name <subnet-id> subnet <prefix>-subnet-public1-us-east-1a
TAGS kubernetes.io/role/elb <subnet-id> subnet 1
Creating the account-wide STS roles and policies
Prerequisites:
- You have completed the AWS prerequisites for ROSA with HCP.
- You have available AWS service quotas.
- You have enabled the ROSA service in the AWS Console.
- You have installed and configured the latest ROSA CLI (rosa) on your installation host.
- You have logged in to your Red Hat account by using the ROSA CLI.
Steps:
- 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:
rosa create account-roles --hosted-cp
- Optional: Set your prefix as an environmental variable by running the following command:
export ACCOUNT_ROLES_PREFIX=<account_role_prefix>
- View the value of the variable by running the following command:
echo $ACCOUNT_ROLES_PREFIX
- View the value of the variable by running the following command:
For more information regarding AWS managed IAM policies for ROSA, see AWS managed IAM policies for ROSA.
Creating an OpenID Connect configuration
When using a ROSA with HCP cluster, you must create the OpenID Connect (OIDC) configuration prior to creating your cluster. This configuration is registered to be used with OpenShift Cluster Manager.
Prerequisites:
- You have completed the AWS prerequisites for ROSA with HCP.
- You have completed the AWS prerequisites for Red Hat OpenShift Service on AWS.
- You have installed and configured the latest Red Hat OpenShift Service on AWS (ROSA) CLI,
rosa
, on your installation host.
Steps:
- To create your OIDC configuration alongside the AWS resources, run the following command:
rosa create oidc-config --mode=auto --yes
- When creating your cluster, you must supply the OIDC config ID. The CLI output provides this value for --mode auto, otherwise you must determine these values based on aws CLI output for --mode manual.
- Optional: you can save the OIDC configuration ID as a variable to use later. Run the following command to save the variable:
export OIDC_ID=<oidc_config_id>
- In the example output above, the OIDC configuration ID is 13cdr6b.
- View the value of the variable by running the following command:
echo $OIDC_ID
- You can list the possible OIDC configurations available for your clusters that are associated with your user organization. Run the following command:
rosa list oidc-config
Creating Operator roles and policies
When using a ROSA with HCP cluster, you must create the Operator IAM roles that are required for Red Hat OpenShift Service on AWS (ROSA) with hosted control planes (HCP) deployments. The cluster Operators use the Operator roles to obtain the temporary permissions required to carry out cluster operations, such as managing back-end storage, cloud provider credentials, and external access to a cluster.
Prerequisites:
- You have completed the AWS prerequisites for ROSA with HCP.
- You have installed and configured the latest Red Hat OpenShift Service on AWS ROSA CLI (rosa), on your installation host.
- You created the account-wide AWS roles.
Steps:
- Set your prefix name to an environment variable using the following command:
export OPERATOR_ROLES_PREFIX=<prefix_name>
To create your Operator roles, run the following command:
rosa create operator-roles --hosted-cp
The following breakdown provides options for the Operator role creation.
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
Notes: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.
This value is the OIDC configuration ID that you created for your ROSA with HCP cluster.
This value is the installer role ARN that you created when you created the ROSA account roles.
You must include the --hosted-cp parameter to create the correct roles for ROSA with HCP clusters. This command returns the following information.
The Operator roles are now created and ready to use for creating your ROSA with HCP cluster.- You can list the Operator roles associated with your ROSA account. Run the following command:
rosa list operator-roles
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.
Creating a ROSA with HCP cluster using the CLI
When using the Red Hat OpenShift Service on AWS (ROSA) CLI, rosa, to create a cluster, you can select the default options to create the cluster quickly.
Prerequisites:
- You have completed the AWS prerequisites for ROSA with HCP.
- You have available AWS service quotas.
- You have enabled the ROSA service in the AWS Console.
- 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.
- You have logged in to your Red Hat account by using the ROSA CLI.
- You have created an OIDC configuration.
- You have verified that the AWS Elastic Load Balancing (ELB) service role exists in your AWS account.
Steps:
- Use one of the following commands to create your ROSA with HCP cluster:
Note: When creating a ROSA with HCP 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 Red Hat OpenShift Service on AWS, see CIDR range definitions.
If you did not set environmental variables, run the following command:
rosa create cluster --cluster-name=<cluster_name> \ <.>
<.> 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. <.> Optional: The--private
argument is used to create private ROSA with HCP clusters. If you use this argument, ensure that you only use your private subnet ID for--subnet-ids
. <.> 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.Note: 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.
- If you set the environmental variables, create a cluster with a single, initial machine pool, using either a publicly or privately available API, and a publicly or privately available Ingress by running the following command:
rosa create cluster --private --cluster-name=<cluster_name> \
--mode=auto --hosted-cp
--operator-roles-prefix=$OPERATOR_ROLES_PREFIX \
--oidc-config-id=$OIDC_ID --subnet-ids=$SUBNET_IDS
- If you set the environmental variables, create a cluster with a single, initial machine pool, a publicly available API, and a publicly available Ingress by running the following command:
rosa create cluster --cluster-name=<cluster_name> --mode=auto \
--hosted-cp --operator-roles-prefix=$OPERATOR_ROLES_PREFIX \
--oidc-config-id=$OIDC_ID --subnet-ids=$SUBNET_IDS
- Check the status of your cluster by running the following command:
rosa describe cluster --cluster=<cluster_name>
The following State field changes are listed in the output as the cluster installation progresses: pending (Preparing account), installing (DNS setup in progress), installing, Ready.
Note: 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 Hat Support for assistance, see Getting support for Red Hat OpenShift Service on AWS. Track the progress of the cluster creation by watching the Red Hat OpenShift Service on AWS installation program logs. To check the logs, run the following command:
rosa logs install --cluster=<cluster_name> --watch \ <.>
<.> Optional: To watch for new log messages as the installation progresses, use the --watch argument.
Other options for creating ROSA with HCP clusters
To learn about other options for how to install Red Hat OpenShift Service on AWS (ROSA) clusters that use hosted control planes, view the following documentation: