Connecting to OpenShift as a pre-requisite
OpenShift is a pre-requisite if the setup is about to be tested on OpenShift. It needs to be completed before Installing Keycloak on OpenShift can begin.
Prerequisites
This requires a running OpenShift instance, any OpenShift instance should work.
To set up OpenShift on AWS, use Red Hat OpenShift Service on AWS (ROSA).
- URL to the console of OpenShift
-
Usually a URL in the form of:
https://console-openshift-console.apps.<domain name>/
- URL to the API of OpenShift
-
Usually a URL in the form of:
https://api.<domain name>:6443/
- User credentials
-
OpenShift user login name and password with
cluster-admin
role to be able to install custom resource definitions.
Connecting to OpenShift
-
Log in to the OpenShift console.
-
Navigate to the question mark icon
(?)
in the upper right corner and choose Command line tools -
Download the
oc
binary for your operating system. -
On Linux, extract it to the folder
~/.bin
-
Add the following snippet to the file
~/.bashrc
to allow auto-completion of commands:source <(oc completion bash)
Verifying the installation
The command:
oc version
Should print an output like:
Client Version: 4.12.0-... Kustomize Version: v4.5.7 Server Version: 4.12.13 Kubernetes Version: v1.25.8+27e744f
The major and minor version for the client and the server should match (4.12
in the example shown above).
Logging in on the command line
Use the following command to log in on the command line and have it prompt for the password. Once you log in, the context switches automatically to that cluster. To switch back for example to the minikube cluster, see Switching between different Kubernetes clusters below.
oc login https://api.<domain name>:6443 -u <username>
The session will expire approximately one a day, and you’ll need to re-login. |
Enable alert routing for user-defined projects
By default, OpenShift HCP doesn’t enable alert routing for user-defined projects.
Apply the following ConfigMap cluster-monitoring-config.yaml which is located in the /provision/openshift
folder to OpenShift:
kubectl apply -n openshift-monitoring -f cluster-monitoring-config.yaml
After this has been deployed, several new pods spin up in the openshift-user-workload-monitoring namespace:
kubectl get pods -n openshift-user-workload-monitoring
Alerts defined in PrometheusRule
CR are then available to view in the menu entry Observe→Alerting in the OpenShift console.
Further reading: