Chapter 7. Accessing a ROSA cluster
It is recommended that you access your Red Hat OpenShift Service on AWS classic architecture (ROSA) cluster using an identity provider (IDP) account. However, the cluster administrator who created the cluster can access it using the quick access procedure.
This document describes how to access a cluster and set up an IDP using the ROSA CLI (rosa). Alternatively, you can create an IDP account using OpenShift Cluster Manager console.
7.1. Accessing your cluster quickly Copy linkLink copied to clipboard!
You can use this quick access procedure to log in to your cluster.
As a best practice, access your cluster with an IDP account instead.
Procedure
Enter the following command:
rosa create admin --cluster=<cluster_name>
$ rosa create admin --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For a Red Hat OpenShift Service on AWS cluster, the port number should be
443.
Enter the
oc logincommand, username, and password from the output of the previous command:Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For a ROSA with HCP cluster, the port number should be
443.
Using the default project, enter this
occommand to verify that the cluster administrator access is created:oc whoami
$ oc whoamiCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
cluster-admin
cluster-adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.2. Accessing your cluster with an IDP account Copy linkLink copied to clipboard!
To log in to your cluster, you can configure an identity provider (IDP). This procedure uses GitHub as an example IDP. To view other supported IDPs, run the rosa create idp --help command.
Alternatively, as the user who created the cluster, you can use the quick access procedure.
Procedure
To access your cluster using an IDP account:
Add an IDP.
The following command creates an IDP backed by GitHub. After running the command, follow the interactive prompts from the output to access your GitHub developer settings and configure a new OAuth application.
rosa create idp --cluster=<cluster_name> --interactive
$ rosa create idp --cluster=<cluster_name> --interactiveCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following values:
-
Type of identity provider:
github -
Restrict to members of:
organizations(if you do not have a GitHub Organization, you can create one now) -
GitHub organizations:
rh-test-org(enter the name of your organization)
Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Type of identity provider:
Follow the URL in the output and select Register application to register a new OAuth application in your GitHub organization. By registering the application, you enable the OAuth server that is built into ROSA to authenticate members of your GitHub organization into your cluster.
NoteThe fields in the Register a new OAuth application GitHub form are automatically filled with the required values through the URL that is defined by the Red Hat OpenShift Service on AWS classic architecture (ROSA) CLI,
rosa.Use the information from the GitHub application you created and continue the prompts. Enter the following values:
-
Client ID:
<my_github_client_id> -
Client Secret: [? for help]
<my_github_client_secret> - Hostname: (optional, you can leave it blank for now)
-
Mapping method:
claim
Continued example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The IDP can take 1-2 minutes to be configured within your cluster.
-
Client ID:
Enter the following command to verify that your IDP has been configured correctly:
rosa list idps --cluster=<cluster_name>
$ rosa list idps --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME TYPE AUTH URL github-1 GitHub https://oauth-openshift.apps.rh-rosa-test-cluster1.j9n4.s1.devshift.org/oauth2callback/github-1
NAME TYPE AUTH URL github-1 GitHub https://oauth-openshift.apps.rh-rosa-test-cluster1.j9n4.s1.devshift.org/oauth2callback/github-1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Log in to your cluster.
Enter the following command to get the
Console URLof your cluster:rosa describe cluster --cluster=<cluster_name>
$ rosa describe cluster --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For a Red Hat OpenShift Service on AWS cluster, the port number should be
443.
-
Navigate to the
Console URL, and log in using your Github credentials. - In the top right of the OpenShift console, click your name and click Copy Login Command.
- Select the name of the IDP you added (in our case github-1), and click Display Token.
Copy and paste the
oclogin command into your terminal.oc login --token=z3sgOGVDk0k4vbqo_wFqBQQTnT-nA-nQLb8XEmWnw4X --server=https://api.rh-rosa-test-cluster1.j9n4.s1.devshift.org:6443
$ oc login --token=z3sgOGVDk0k4vbqo_wFqBQQTnT-nA-nQLb8XEmWnw4X --server=https://api.rh-rosa-test-cluster1.j9n4.s1.devshift.org:64431 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For a ROSA with HCP cluster, use the port number
443.
Example output
Logged into "https://api.rh-rosa-cluster1.j9n4.s1.devshift.org:6443" as "rh-rosa-test-user" using the token provided. You have access to 67 projects, the list has been suppressed. You can list all projects with 'oc projects' Using project "default".
Logged into "https://api.rh-rosa-cluster1.j9n4.s1.devshift.org:6443" as "rh-rosa-test-user" using the token provided.1 You have access to 67 projects, the list has been suppressed. You can list all projects with 'oc projects' Using project "default".Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For a ROSA with HCP cluster, the port number should be
443.
Enter a simple
occommand to verify everything is setup properly and that you are logged in.oc version
$ oc versionCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Client Version: 4.4.0-202005231254-4a4cd75 Server Version: 4.3.18 Kubernetes Version: v1.16.2
Client Version: 4.4.0-202005231254-4a4cd75 Server Version: 4.3.18 Kubernetes Version: v1.16.2Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.3. Granting cluster-admin access Copy linkLink copied to clipboard!
As the user who created the cluster, add the cluster-admin user role to your account to have the maximum administrator privileges. These privileges are not automatically assigned to your user account when you create the cluster.
Additionally, only the user who created the cluster can grant cluster access to other cluster-admin or dedicated-admin users. Users with dedicated-admin access have fewer privileges. As a best practice, limit the number of cluster-admin users to as few as possible.
Prerequisites
- You have added an identity provider (IDP) to your cluster.
- You have the IDP user name for the user you are creating.
- You are logged in to the cluster.
Procedure
Give your user
cluster-adminprivileges:rosa grant user cluster-admin --user=<idp_user_name> --cluster=<cluster_name>
$ rosa grant user cluster-admin --user=<idp_user_name> --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify your user is listed as a cluster administrator:
rosa list users --cluster=<cluster_name>
$ rosa list users --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
GROUP NAME cluster-admins rh-rosa-test-user dedicated-admins rh-rosa-test-user
GROUP NAME cluster-admins rh-rosa-test-user dedicated-admins rh-rosa-test-userCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to verify that your user now has
cluster-adminaccess. A cluster administrator can run this command without errors, but a dedicated administrator cannot.oc get all -n openshift-apiserver
$ oc get all -n openshift-apiserverCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.4. Granting dedicated-admin access Copy linkLink copied to clipboard!
Only the user who created the cluster can grant cluster access to other cluster-admin or dedicated-admin users. Users with dedicated-admin access have fewer privileges. As a best practice, grant dedicated-admin access to most of your administrators.
Prerequisites
- You have added an identity provider (IDP) to your cluster.
- You have the IDP user name for the user you are creating.
- You are logged in to the cluster.
Procedure
Enter the following command to promote your user to a
dedicated-admin:rosa grant user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>
$ rosa grant user dedicated-admin --user=<idp_user_name> --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to verify that your user now has
dedicated-adminaccess:oc get groups dedicated-admins
$ oc get groups dedicated-adminsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME USERS dedicated-admins rh-rosa-test-user
NAME USERS dedicated-admins rh-rosa-test-userCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteA
Forbiddenerror displays if user withoutdedicated-adminprivileges runs this command.