Skip to content

Step 4: Deploy keycloak

Rushikesh Pharate edited this page May 6, 2022 · 2 revisions
  1. Make sure you are in keycloak folder and run below command
helm repo add bitnami https://charts.bitnami.com/bitnami
  1. Create persistent volumes and deploy postgres and keyclaok
kubectl apply -f pv.yaml
kubectl apply -f pv1.yaml
kubectl apply -f pv2.yaml

helm install keycloak-db-postgresql bitnami/postgresql -f values.yaml -n keycloak --version 10.12.3
  1. Installing OLM
cd ..
kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
  1. Installing Keycloak Operator
git clone https://github.com/keycloak/keycloak-operator

cp operator.yaml keycloak-operator/deploy/
cd keycloak-operator
make cluster/prepare
kubectl apply -f deploy/operator.yaml -n keycloak
  1. Apply the db secret (modified as suggested in above step) along with custos keycloak resource
cd ..
kubectl apply -f keycloak-db-secret.yaml -n keycloak
kubectl apply -f custos-keycloak.yaml -n keycloak

  1. Install ingress. Please note before this step its critical to update hostname in your ingress.yaml (Change hostname to the master domain name)
kubectl apply -f ingress.yaml -n keycloak

After this wait for around 5 mins to be on the safer side and let kubernetes to all the setup. Your keyvloak pods should look like this

Also, to check if your keycloak is deployed successfully run the below command. This should return True if not it means there is something wrong with your deployment.