Getting started Red Hat OpenShift Service on AWS 4 Setting up clusters and accounts Red Hat OpenShift Documentation Team

Commands:
aws sts get-caller-identity --output text
<aws_account_id> arn:aws:iam::<aws_account_id>:user/<username> <aws_user_id>
tar xvf rosa-linux.tar.gz
sudo mv rosa /usr/local/bin/rosa
rosa version
1.2.47 Your ROSA CLI is up to date.
rosa login
To login to your Red Hat account, get an offline access token at https://console.redhat.com/openshift/token/rosa ? Copy the token and paste it here:
? Copy the token and paste it here: ******************* [full token length omitted]
rosa whoami
AWS Account ID: <aws_account_number> AWS Default Region: us-east-1 AWS ARN: arn:aws:iam::<aws_account_number>:user/<aws_user_name> OCM API: https://api.openshift.com OCM Account ID: <red_hat_account_id> OCM Account Name: Your Name OCM Account Username: you@domain.com OCM Account Email: you@domain.com OCM Organization ID: <org_id> OCM Organization Name: Your organization OCM Organization External ID: <external_org_id>
rosa download openshift-client
tar xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/oc
rosa verify openshift-client
I: Verifying whether OpenShift command-line tool is available I: Current OpenShift Client Version: 4.17.3
rosa create ocm-role
rosa create user-role
rosa create account-roles
rosa create admin --cluster=<cluster_name> 1
W: It is recommended to add an identity provider to login to this cluster. See 'rosa create idp --help' for more information. I: Admin account has been added to cluster '<cluster_name>'. I: Please securely store this generated password. If you lose this password you can delete and recreate the cluster admin user. I: To login, run the following command: oc login https://api.example-cluster.wxyz.p1.openshiftapps.com:6443 --username cluster-admin --password d7Rca-Ba4jy-YeXhs-WU42J I: It may take up to a minute for the account to become active.
rosa create idp --cluster=<cluster_name> --interactive 1
I: Interactive mode enabled. Any optional fields can be left empty and a default will be selected. ? Type of identity provider: github ? Identity provider name: github-1 ? Restrict to members of: organizations ? GitHub organizations: <github_org_name> 1 ? To use GitHub as an identity provider, you must first register the application: - Open the following URL: https://github.com/organizations/<github_org_name>/settings/applications/new?oauth_application%5Bcallback_url%5D=https%3A%2F%2Foauth-openshift.apps.<cluster_name>/<random_string>.p1.openshiftapps.com%2Foauth2callback%2Fgithub-1&oauth_application%5Bname%5D=<cluster_name>&oauth_application%5Burl%5D=https%3A%2F%2Fconsole-openshift-console.apps.<cluster_name>/<random_string>.p1.openshiftapps.com - Click on 'Register application'
? Client ID: <github_client_id> 1 ? Client Secret: [? for help] <github_client_secret> 2 ? GitHub Enterprise Hostname (optional): ? Mapping method: claim 3 I: Configuring IDP for cluster '<cluster_name>' I: Identity Provider 'github-1' has been created. It will take up to 1 minute for this configuration to be enabled. To add cluster administrators, see 'rosa grant user --help'. To login into the console, open https://console-openshift-console.apps.<cluster_name>.<random_string>.p1.openshiftapps.com and click on github-1.
rosa list idps --cluster=<cluster_name>
NAME TYPE AUTH URL github-1 GitHub https://oauth-openshift.apps.<cluster_name>.<random_string>.p1.openshiftapps.com/oauth2callback/github-1
rosa grant user cluster-admin --user=<idp_user_name> --cluster=<cluster_name> 1
I: Granted role 'cluster-admins' to user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
ID GROUPS <idp_user_name> cluster-admins
rosa grant user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>
I: Granted role 'dedicated-admins' to user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
ID GROUPS <idp_user_name> dedicated-admins
rosa describe cluster -c <cluster_name> | grep Console 1
Console URL: https://console-openshift-console.apps.example-cluster.wxyz.p1.openshiftapps.com
https://nodejs-<project>.<cluster_name>.<hash>.<region>.openshiftapps.com/
Welcome to your Node.js application on OpenShift
rosa revoke user cluster-admin --user=<idp_user_name> --cluster=<cluster_name> 1
? Are you sure you want to revoke role cluster-admins from user <idp_user_name> in cluster <cluster_name>? Yes I: Revoked role 'cluster-admins' from user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
W: There are no users configured for cluster '<cluster_name>'
rosa revoke user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>
? Are you sure you want to revoke role dedicated-admins from user <idp_user_name> in cluster <cluster_name>? Yes I: Revoked role 'dedicated-admins' from user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
W: There are no users configured for cluster '<cluster_name>'
rosa delete cluster --cluster=<cluster_name> --watch
rosa delete oidc-provider -c <cluster_id> --mode auto 1
rosa delete operator-roles -c <cluster_id> --mode auto 1
rosa delete account-roles --prefix <prefix> --mode auto 1
aws sts get-caller-identity --output text
<aws_account_id> arn:aws:iam::<aws_account_id>:user/<username> <aws_user_id>
tar xvf rosa-linux.tar.gz
sudo mv rosa /usr/local/bin/rosa
rosa version
1.2.47 Your ROSA CLI is up to date.
rosa login
To login to your Red Hat account, get an offline access token at https://console.redhat.com/openshift/token/rosa ? Copy the token and paste it here:
? Copy the token and paste it here: ******************* [full token length omitted]
rosa whoami
AWS Account ID: <aws_account_number> AWS Default Region: us-east-1 AWS ARN: arn:aws:iam::<aws_account_number>:user/<aws_user_name> OCM API: https://api.openshift.com OCM Account ID: <red_hat_account_id> OCM Account Name: Your Name OCM Account Username: you@domain.com OCM Account Email: you@domain.com OCM Organization ID: <org_id> OCM Organization Name: Your organization OCM Organization External ID: <external_org_id>
rosa download openshift-client
tar xvf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin/oc
rosa verify openshift-client
I: Verifying whether OpenShift command-line tool is available I: Current OpenShift Client Version: 4.17.3
rosa create admin --cluster=<cluster_name> 1
W: It is recommended to add an identity provider to login to this cluster. See 'rosa create idp --help' for more information. I: Admin account has been added to cluster '<cluster_name>'. I: Please securely store this generated password. If you lose this password you can delete and recreate the cluster admin user. I: To login, run the following command: oc login https://api.example-cluster.wxyz.p1.openshiftapps.com:6443 --username cluster-admin --password d7Rca-Ba4jy-YeXhs-WU42J I: It may take up to a minute for the account to become active.
oc login <api_url> --username cluster-admin --password <cluster_admin_password> 1
oc whoami
cluster-admin
rosa create idp --cluster=<cluster_name> --interactive 1
I: Interactive mode enabled. Any optional fields can be left empty and a default will be selected. ? Type of identity provider: github ? Identity provider name: github-1 ? Restrict to members of: organizations ? GitHub organizations: <github_org_name> 1 ? To use GitHub as an identity provider, you must first register the application: - Open the following URL: https://github.com/organizations/<github_org_name>/settings/applications/new?oauth_application%5Bcallback_url%5D=https%3A%2F%2Foauth-openshift.apps.<cluster_name>/<random_string>.p1.openshiftapps.com%2Foauth2callback%2Fgithub-1&oauth_application%5Bname%5D=<cluster_name>&oauth_application%5Burl%5D=https%3A%2F%2Fconsole-openshift-console.apps.<cluster_name>/<random_string>.p1.openshiftapps.com - Click on 'Register application'
? Client ID: <github_client_id> 1 ? Client Secret: [? for help] <github_client_secret> 2 ? GitHub Enterprise Hostname (optional): ? Mapping method: claim 3 I: Configuring IDP for cluster '<cluster_name>' I: Identity Provider 'github-1' has been created. It will take up to 1 minute for this configuration to be enabled. To add cluster administrators, see 'rosa grant user --help'. To login into the console, open https://console-openshift-console.apps.<cluster_name>.<random_string>.p1.openshiftapps.com and click on github-1.
rosa list idps --cluster=<cluster_name>
NAME TYPE AUTH URL github-1 GitHub https://oauth-openshift.apps.<cluster_name>.<random_string>.p1.openshiftapps.com/oauth2callback/github-1
rosa grant user cluster-admin --user=<idp_user_name> --cluster=<cluster_name> 1
I: Granted role 'cluster-admins' to user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
ID GROUPS <idp_user_name> cluster-admins
rosa grant user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>
I: Granted role 'dedicated-admins' to user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
ID GROUPS <idp_user_name> dedicated-admins
rosa describe cluster -c <cluster_name> | grep Console 1
Console URL: https://console-openshift-console.apps.example-cluster.wxyz.p1.openshiftapps.com
https://nodejs-<project>.<cluster_name>.<hash>.<region>.openshiftapps.com/
Welcome to your Node.js application on OpenShift
rosa revoke user cluster-admin --user=<idp_user_name> --cluster=<cluster_name> 1
? Are you sure you want to revoke role cluster-admins from user <idp_user_name> in cluster <cluster_name>? Yes I: Revoked role 'cluster-admins' from user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
W: There are no users configured for cluster '<cluster_name>'
rosa revoke user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>
? Are you sure you want to revoke role dedicated-admins from user <idp_user_name> in cluster <cluster_name>? Yes I: Revoked role 'dedicated-admins' from user '<idp_user_name>' on cluster '<cluster_name>'
rosa list users --cluster=<cluster_name>
W: There are no users configured for cluster '<cluster_name>'
rosa delete cluster --cluster=<cluster_name> --watch
rosa delete oidc-provider -c <cluster_id> --mode auto 1
rosa delete operator-roles -c <cluster_id> --mode auto 1
rosa delete account-roles --prefix <prefix> --mode auto 1