Skip to content

Commit e6fae3e

Browse files
committed
Reference to official RHBK guide
Signed-off-by: mrrajan <[email protected].>
1 parent 82e73b0 commit e6fae3e

File tree

1 file changed

+5
-148
lines changed

1 file changed

+5
-148
lines changed

docs/book/modules/admin/pages/infrastructure.adoc

Lines changed: 5 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -361,153 +361,10 @@ Install the following Red Hat services:
361361

362362
=== Red Hat Build of Keycloak Operator
363363

364-
* Install Red Hat Build of Keycloak Operator with deployment https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.2/html/operator_guide/installation-[guide].
365-
366-
==== Prerequisites
367-
The Prerequisites for the Keycloak operator configuration are,
368-
369-
* Database
370-
* Hostname
371-
* TLS certificate and keys
372-
373-
[[_keycloak_postgres]]
374-
===== Create PostgreSQL instance
375-
* Login to `registry.redhat.io` using podman or docker cli
376-
* Create Image pull secret for `registry.redhat.io` using the below command
377-
+
378-
[source,bash]
379-
----
380-
oc create secret generic docker-cred --from-file=.dockerconfigjson=$XDG_RUNTIME_DIR/containers/auth.json --type=kubernetes.io/dockerconfigjson
381-
----
382-
383-
* Create PostgreSQL database instance for Keycloak persistent storage with the below `StatefulSet` and `Service`
384-
+
385-
[source,yaml]
386-
----
387-
apiVersion: apps/v1
388-
kind: StatefulSet
389-
metadata:
390-
name: postgres-tpa
391-
namespace: <Installation Namespace>
392-
spec:
393-
serviceName: postgres-tpa-service
394-
selector:
395-
matchLabels:
396-
app: postgres-tpa
397-
replicas: 1
398-
template:
399-
metadata:
400-
labels:
401-
app: postgres-tpa
402-
spec:
403-
imagePullSecrets:
404-
- name: docker-cred # Image pull secret
405-
containers:
406-
- name: postgres-tpa
407-
image: registry.redhat.io/rhel9/postgresql-16 # Postgres image provided by Red Hat
408-
volumeMounts:
409-
- mountPath: /data
410-
name: cache-volume
411-
env:
412-
- name: POSTGRESQL_USER
413-
value: trustify
414-
- name: POSTGRESQL_PASSWORD
415-
value: trustify1234
416-
- name: POSTGRESQL_DATABASE
417-
value: trustify
418-
volumes:
419-
- name: cache-volume
420-
emptyDir: {}
421-
---
422-
apiVersion: v1
423-
kind: Service
424-
metadata:
425-
name: postgres-tpa
426-
spec:
427-
selector:
428-
app: postgres-tpa
429-
type: ClusterIP
430-
ports:
431-
- port: 5432
432-
targetPort: 5432
433-
----
434-
435-
[[_keycloak_hostname_]]
436-
===== Hostname
437-
* Keycloak can be exposed using OpenShift's DNS and wildcard routes. Retrieve the wild card with the below command,
438-
+
439-
[source, bash]
440-
----
441-
oc login
442-
export NAMESPACE=<Installation Namespace>
443-
export APP_DOMAIN=-$NAMESPACE.$(kubectl -n openshift-ingress-operator get ingresscontrollers.operator.openshift.io default -o jsonpath='{.status.domain}')
444-
----
445-
446-
The value in `APP_DOMAIN` can be used for keycloak `hostname`
447-
448-
===== TLS certs and keys
449-
* Retrieve the default router's TLS key and certificate, which will be used as a trust anchor for Keycloak. Then, create a Kubernetes `Secret` from these files.
450-
+
451-
[source,bash]
452-
----
453-
oc get secret -n openshift-ingress router-certs-default -o go-template='{{index .data "tls.key"}}' | base64 -d > tls.key
454-
oc get secret -n openshift-ingress router-certs-default -o go-template='{{index .data "tls.crt"}}' | base64 -d > tls.crt
455-
oc create secret tls my-tls-secret --cert=tls.crt --key=tls.key -n <Installation Namespace>
456-
----
457-
+
458-
[NOTE]
459-
For OCP V4.19, the secret name is `router-certs`
460-
461-
==== Installation
462-
* Make sure the Red Hat Build of Keycloak Operator is installed. Refer - Deployment https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.2/html/operator_guide/installation-[guide]
463-
* Create a `Secret` to store the PostgreSQL database <<_keycloak_postgres,credentials>> that Keycloak will use to connect to the database.
464-
+
465-
[source,bash]
466-
----
467-
oc create secret generic keycloak-db-secret --from-literal=username=trustify --from-literal=password=trustify1234 -n <Installation Namespace>
468-
----
469-
470-
* Define the `Keycloak` Custom Resource (CR) that the Keycloak Operator will use to deploy and configure your Keycloak instance.
471-
+
472-
[source,yaml]
473-
----
474-
apiVersion: k8s.keycloak.org/v2alpha1
475-
kind: Keycloak
476-
metadata:
477-
name: example-kc
478-
spec:
479-
instances: 1
480-
db:
481-
vendor: postgres
482-
usernameSecret:
483-
name: keycloak-db-secret
484-
key: username
485-
passwordSecret:
486-
name: keycloak-db-secret
487-
key: password
488-
host: postgres-tpa
489-
database: trustify
490-
port: 5432
491-
http:
492-
httpEnabled: true
493-
httpPort: 8180
494-
httpsPort: 8543
495-
tlsSecret: my-tls-secret
496-
hostname:
497-
hostname: https://sso<Replace with$APP_DOAMIN> # APP_DOMAIN value --> 1
498-
strict: false
499-
backchannelDynamic: true
500-
transaction:
501-
xaEnabled: false
502-
----
503-
+
504-
**References:**
505-
+
506-
. _APP_DOMAIN value:_ Replace the hostname with the APP_DOMAIN value retrieved from <<_keycloak_hostname_,Hostname>> step. The example would be something like this,
507-
`hostname: https://sso-tpa.apps.ocp.cluster.net`
364+
* Install and Deploy Red Hat Build of Keycloak Operator with https://docs.redhat.com/en/documentation/red_hat_build_of_keycloak/26.2/html/operator_guide/index[guide].
508365

509366
[[_keycloak_usage_]]
510-
===== Usage
367+
==== Retrieve Admin Credentials
511368
* Retrieve the Admin console username and password using the below commands,
512369
+
513370
[source, bash]
@@ -516,8 +373,7 @@ oc get secret example-kc-initial-admin -n $NAMESPACE -o jsonpath='{.data.usernam
516373
oc get secret example-kc-initial-admin -n $NAMESPACE -o jsonpath='{.data.password}' | base64 --decode
517374
----
518375
* On Openshift console, Go to Networking -> Routes
519-
* Retrieve the Route of keycloak, Open the keycloak admin console
520-
* Login to Keycloak admin console using the secrets retrieved above
376+
* Retrieve the Route of keycloak
521377

522378
==== Configuring Keycloak
523379
Complete the following steps to configure Keycloak for RHTPA
@@ -609,7 +465,8 @@ Complete the following steps to configure Keycloak for RHTPA
609465

610466
[[_keycloak_config_script]]
611467
===== Create Realm, Roles, clients, client scopes and users
612-
* Update the below shell script with the keycloak details to create Realm, role, clients, client scopes and Users
468+
* Update the shell script below with the appropriate Keycloak configurations to create the Realm, roles, clients, client scopes, and users
469+
* Execute the script to apply the changes
613470
+
614471
++++
615472
<details>

0 commit comments

Comments
 (0)