|
| 1 | +--- |
| 2 | +title: OpenShift Prerequisites |
| 3 | +linkTitle: 2. OpenShift Prerequisites |
| 4 | +weight: 2 |
| 5 | +time: 15 minutes |
| 6 | +--- |
| 7 | + |
| 8 | +The steps below are required before deploying the OpenShift cluster in AWS. |
| 9 | + |
| 10 | +## Create a Red Hat Login |
| 11 | + |
| 12 | +The first thing we'll need to do is create an account with Red Hat, which we can do by |
| 13 | +filling out the form |
| 14 | +[here](https://www.redhat.com/wapps/ugc/register.html?_flowId=register-flow&_flowExecutionKey=e1s1). |
| 15 | + |
| 16 | +## Install the AWS CLI |
| 17 | + |
| 18 | +To install the AWS CLI on the EC2 instance provisioned previously, run the following commands: |
| 19 | + |
| 20 | +``` bash |
| 21 | +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" |
| 22 | +sudo apt install unzip |
| 23 | +unzip awscliv2.zip |
| 24 | +sudo ./aws/install |
| 25 | +``` |
| 26 | + |
| 27 | +Use the following command to ensure it was installed successfully: |
| 28 | + |
| 29 | +``` bash |
| 30 | +aws --version |
| 31 | +``` |
| 32 | + |
| 33 | +It should return something like the following: |
| 34 | + |
| 35 | +```` |
| 36 | +aws-cli/2.30.5 Python/3.13.7 Linux/6.14.0-1011-aws exe/x86_64.ubuntu.24 |
| 37 | +```` |
| 38 | + |
| 39 | +Login to your AWS account using your preferred method. Refer to the |
| 40 | +[documentation](https://docs.aws.amazon.com/signin/latest/userguide/command-line-sign-in.html) |
| 41 | +for guidance. For example, you can login by running the `aws configure` command. |
| 42 | + |
| 43 | +Confirm you're logged in successfully by running a command such as `aws ec2 describe-instances`. |
| 44 | + |
| 45 | +Then, verify your account identity with: |
| 46 | + |
| 47 | +``` bash |
| 48 | +aws sts get-caller-identity |
| 49 | +``` |
| 50 | + |
| 51 | +Check whether the service role for ELB (Elastic Load Balancing) exists: |
| 52 | + |
| 53 | +``` bash |
| 54 | +aws iam get-role --role-name "AWSServiceRoleForElasticLoadBalancing" |
| 55 | +``` |
| 56 | + |
| 57 | +If the role does not exist, create it by running the following command: |
| 58 | + |
| 59 | +``` bash |
| 60 | +aws iam create-service-linked-role --aws-service-name "elasticloadbalancing.amazonaws.com" |
| 61 | +``` |
| 62 | + |
| 63 | +## Install the ROSA CLI |
| 64 | + |
| 65 | +We'll use the ROSA command-line interface (CLI) for the deployment. The instructions are |
| 66 | +based on [Red Hat documentation](https://docs.redhat.com/en/documentation/red_hat_openshift_service_on_aws_classic_architecture/4/html-single/install_rosa_classic_clusters/index#rosa-installing-and-configuring-the-rosa-cli_rosa-installing-cli). |
| 67 | + |
| 68 | +You can download the latest release of the ROSA CLI for your operating system |
| 69 | +[here](https://console.redhat.com/openshift/downloads). |
| 70 | + |
| 71 | +Alternatively, we can use the following command to download the CLI binary directly |
| 72 | +to our EC2 instance: |
| 73 | + |
| 74 | +```` |
| 75 | +curl -L -O https://mirror.openshift.com/pub/cgw/rosa/latest/rosa-linux.tar.gz |
| 76 | +```` |
| 77 | + |
| 78 | +Extract the contents: |
| 79 | + |
| 80 | +```` |
| 81 | +tar -xvzf rosa-linux.tar.gz |
| 82 | +```` |
| 83 | + |
| 84 | +Move the resulting file (`rosa`) to a location that's included as part of your path. For example: |
| 85 | + |
| 86 | +``` bash |
| 87 | +sudo mv rosa /usr/local/bin/rosa |
| 88 | +``` |
| 89 | + |
| 90 | +Log in to your Red Hat account by running the command below, then follow the instructions |
| 91 | +in the command output: |
| 92 | + |
| 93 | +```` |
| 94 | +rosa login --use-device-code |
| 95 | +```` |
| 96 | + |
| 97 | +## Install the OpenShift CLI (oc) |
| 98 | + |
| 99 | +We can use the following command to download the OpenShift CLI binary directly |
| 100 | +to our EC2 instance: |
| 101 | + |
| 102 | +```` |
| 103 | +curl -L -O https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz |
| 104 | +```` |
| 105 | + |
| 106 | +Extract the contents: |
| 107 | + |
| 108 | +```` |
| 109 | +tar -xvzf openshift-client-linux.tar.gz |
| 110 | +```` |
| 111 | + |
| 112 | +Move the resulting files (`oc` and `kubectl`) to a location that's included as part of your path. For example: |
| 113 | + |
| 114 | +``` bash |
| 115 | +sudo mv oc /usr/local/bin/oc |
| 116 | +sudo mv kubectl /usr/local/bin/kubectl |
| 117 | +``` |
| 118 | + |
| 119 | +## Create Account-Wide Roles and Policies |
| 120 | + |
| 121 | +Use the following command to create the necessary account-wide roles and policies: |
| 122 | + |
| 123 | +``` bash |
| 124 | +rosa create account-roles --mode auto |
| 125 | +``` |
| 126 | + |
| 127 | +## Create an AWS VPC for ROSA HCP |
| 128 | + |
| 129 | +We're going to use the Hosted Control Plane (HCP) deployment option to |
| 130 | +deploy our OpenShift cluster. To do this, we'll need to |
| 131 | +create a new VPC in our AWS account using the following command: |
| 132 | + |
| 133 | +> Note: update the region as appropriate for your environment. |
| 134 | +
|
| 135 | +``` bash |
| 136 | +rosa create network --param Region=us-east-2 |
| 137 | +``` |
| 138 | + |
| 139 | +> Important: make note of the subnet ids created as a result of this command |
| 140 | +> as you'll need them when creating the cluster. |
| 141 | +
|
| 142 | +> Note: by default, each AWS region is limited to 5 elastic IP addresses. |
| 143 | +> If you receive the following error: |
| 144 | +> "The maximum number of addresses has been reached." |
| 145 | +> then you'll need to contact AWS to request an increase to this limit, |
| 146 | +> or choose another AWS region to create the VPC for ROSA. |
| 147 | +
|
| 148 | +## Create an OpenID Connect configuration |
| 149 | + |
| 150 | +Before creating a Red Hat OpenShift Service on AWS cluster, let's create the OpenID Connect (OIDC) |
| 151 | +configuration with the following command: |
| 152 | + |
| 153 | +``` bash |
| 154 | +rosa create oidc-config --mode=auto --yes |
| 155 | +``` |
| 156 | + |
| 157 | +> Important: make note of the oidc-provider id that is created. |
0 commit comments