In this exercise, you will install Red Hat 3scale API Management by using the 3scale OpenShift operator, and then install the 3scale Toolbox CLI.
Outcomes
You should be able to:
Install Red Hat 3scale API Management on OpenShift by using the 3scale OpenShift operator.
Install the 3scale Toolbox CLI.
You must be logged in to the workstation machine as the student user.
Run the following command to ensure that your OpenShift cluster is running properly.
[student@workstation ~]$ lab start install-setup
Procedure 1.2. Instructions
Log in to the Red Hat OpenShift web console with an account that has cluster administrator privileges.
Navigate to https://console-openshift-console.apps.ocp4.example.com to access the OpenShift web console.
If a certificate errors appears, then accept the self-signed certificates.
In the Log in with page, click .
Log in with the following credentials:
Username: admin
Password: redhat
Create a new OpenShift project, where you will install the 3scale Operator.
In the Administrator pane, click → .
Click and type 3scale in the Name field.
Then, click .
Install the 3scale OpenShift operator by using the OpenShift Console.
In the Administrator pane, click → .
In the Filter by keyword text box, type 3scale.
Select the Red Hat Integration - 3scale operator, and then click .
![]() |
Complete the form according to the following parameters, and then click .
Update channel: threescale-2.11
Installed Namespace: 3scale
Update approval: Automatic
The operator takes some time to install.
Click to access the operator details page.
![]() |
Deploy the APIManager custom resource.
In the Provided APIs section, find APIManager.
Click .
The Create APIManager form displays.
The button does not appear until the 3scale operator becomes ready.
If you do not see the button, then wait until the 3scale operator finishes the deployment process.
Click in the Configure via section to see the APIManager custom resource as a YAML file.
Update the YAML according to the following snippet.
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: apimanager-sample
namespace: 3scale
spec:
wildcardDomain: apps.ocp4.example.com
resourceRequirementsEnabled: falseThe wildcardDomain field is used to create the accessible routes of 3scale.
For example, the Admin Portal might be 3scale-admin..wildcardDomain
The wildcardDomain field should be a resolvable domain.
Usually, it is the domain where you are running your OpenShift cluster.
In the previous YAML snippet you use the apps.ocp4.example.com domain because it is the domain used by the OpenShift cluster in the workstation environment.
Click .
The APIManager deployment creates several OpenShift resources, therefore, it takes several minutes for all the pods to be available.
In the meantime, you can proceed with the exercise by installing the 3scale Toolbox CLI.
Install the 3scale Toolbox CLI.
The official way of installing the Toolbox is by using the 3scale Toolbox CLI container image, registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11.
In a web browser, navigate to https://access.redhat.com/terms-based-registry/.
Log in with your Red Hat account if necessary.
The page displays your current Red Hat Service Accounts, if you have any.
Click to create a new Service Account.
In the Name field type do240, and then click .
Your username also includes the random string of numbers provided before the Name field.
For example, if you provide the do240 name, then a possible username string is 89238478|do240.
The Token Information page displays your username and token.
Keep this page open, as the contents are necessary later in this exercise.
In your command-line terminal, log in to the Red Hat Registry by using Podman. Use the username and token from the previous step.
[student@workstation ~]$podman login registry.redhat.ioUsername:username_from_previous_stepPassword:token_from_previous_step
Pull the 3scale Toolbox CLI image from the Red Hat Registry by using Podman.
[student@workstation ~]$ podman pull \
registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11
Trying to pull registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11...
...output omitted...Verify the installation.
You can use podman run to execute the 3scale Toolbox CLI by using the following format:
podman run registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale COMMANDFor example, if you want to execute the help command in the 3scale Toolbox CLI.
[student@workstation ~]$ podman run \
registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale help
NAME
3scale - 3scale toolbox
USAGE
3scale <sub-command> [options]
...output omitted...Because using podman run is too long, you can create a bash alias.
[student@workstation ~]$ alias 3scale="podman run \
registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale"Now you can run 3scale .
For example, you can run the COMMAND3scale help command.
[student@workstation ~]$ 3scale help
NAME
3scale - 3scale toolbox
USAGE
3scale <sub-command> [options]
...output omitted...In the 3scale Toolbox CLI, add a remote for the default 3scale tenant.
Log in to RHOCP:
[student@workstation ~]$ oc login -u admin -p redhat api.ocp4.example.com:6443
Login successful.
...output omitted...In your command-line terminal, use the oc get secret command to retrieve the password for the 3scale tenant Admin Portal.
[student@workstation ~]$ oc get secret system-seed -n 3scale \
--template={{.data.ADMIN_PASSWORD}} | base64 -d; echoThe default passwords of 3scale are stored in the system-seed secret.
By executing the previous command, you retrieve the ADMIN_PASSWORD entry of the system-seed secret.
Then, because the secret is encoded in Base64, you decode it.
Navigate to https://3scale-admin.apps.ocp4.example.com, the 3scale tenant Admin Portal.
Log in with the the following credentials:
Username: admin
Password: Password from the system-seed secret
As noted before, the deployment of the APIManager custom resource takes several minutes. If the Admin Portal is not accessible, try again in a few minutes.
If the How does 3scale work page displays, click to close it.
In the top pane, click to display the drop down menu. Then, click .
![]() |
In the left pane, click → .
In the Access Tokens section, click .
Complete the form according to the following values:
Name:
toolbox
Scopes: All (select Billing API, Account Management API, Analytics API and Policy Registry API)
Permission:
Read & Write
Then, click . Save the access token displayed.
Using the official 3scale Toolbox CLI image, create a container with a name of toolbox-original.
This image must contain the remote information.
[student@workstation ~]$ podman run --name=toolbox-original \
registry.redhat.io/3scale-amp2/toolbox-rhel8:3scale2.11 3scale remote \
add 3scale-tenant -k https://ACCESS_TOKEN@3scale-admin.apps.ocp4.example.comBecause podman run creates a new container on every execution, the information added is not kept between executions.
A solution to this issue is creating a new image from the original 3scale Toolbox CLI image that contains the remote information.
This way, you use podman run to execute an image with the remote information on every execution.
If you make a mistake in this step, execute podman rm toolbox-original.
Then, you can execute the preceding command again.
Create an image from the toolbox-original container.
[student@workstation ~]$ podman commit toolbox-original toolbox
Getting image source signatures
...output omitted...
Writing manifest to image destination
Storing signaturesUpdate the 3scale bash alias to use the new image.
[student@workstation ~]$ alias 3scale="podman run toolbox 3scale -k"The classroom workstation includes a .bashrc file with the preceding alias configured.
Future workstation sessions do not require setting the alias again.
Note that the -k option allows connections without an SSL certificate.
Now you can list the remotes by using the 3scale alias.
[student@workstation ~]$3scale remote list3scale-tenant https://3scale-admin.apps.ocp4.example.comaccess-token
This concludes the guided exercise.