-
Notifications
You must be signed in to change notification settings - Fork 0
Deploying Keycloak and Postgres on Kubernetes for ENAPSO Services
This guide provides step-by-step instructions for deploying Keycloak and Postgres as dependencies for the ENAPSO SDK.
Before you start, make sure you have the following:
- Access to a Kubernetes platform
- Knowledge of the
kubectl
andHelm
command line tools
To install Postgres, follow these steps:
- Add the Bitnami charts repository by running the following command:
helm repo add bitnami https://charts.bitnami.com/bitnami
- Install Postgres with the following command:
helm install postgres --set-string fullnameOverride=postgres
--set global.postgresql.auth.database=keycloak
--set global.postgresql.auth.username=<your username>
--set global.postgresql.auth.password=<your password> bitnami/postgresql
Replace <your username>
and <your password>
with your desired username and password, which will be used later in the Keycloak deployment.
To install Keycloak, follow these steps:
-
Use the
onprem-resources/kubernetes/keycloack/keycloak-deploy-svc.yaml
file included in this repository as a template for your deployment and service for Keycloak. -
In the deployment section of the file, set the following environmental variables according to your setup:
-
DB_VENDOR
: Set this toPOSTGRES
. -
DB_ADDR
: Set this to the name of the service for Postgres, which is typicallypostgres
. -
DB_DATABASE
: Set this to the name of the database you set earlier for Postgres. -
DB_USER
: Set this to the username you set earlier for Postgres. -
DB_SCHEMA
: Set this topublic
. -
DB_PASSWORD
: Set this to the password you set earlier for Postgres. -
KEYCLOAK_USER
: Set this to the username for the initial Keycloak user. The default value isadmin
. -
KEYCLOAK_PASSWORD
: Set this to the password for the initial Keycloak user. The default value isadmin
. -
KEYCLOAK_FRONTEND_URL
: Set this to the Keycloak frontend URL at which you will access the Keycloak dashboard. -
PROXY_ADDRESS_FORWARDING
: Set this to"true"
.
-
In the service section of the file, set the type to
LoadBalancer
orClusterIP
, depending on your needs. -
Apply the deployment and service YAML file by running the following command:
kubectl apply -f onprem-resources/kubernetes/keycloack/keycloak-deploy-svc.yaml
- To make Keycloak reachable from the internet, create an ingress rule by using the example in the
onprem-resources/kubernetes/keycloack/keycloak-ing.yaml
file. The specifics of this rule will depend on your environment.
To import the initial tenant for Keycloak
To import the initial tenant for Keycloak, follow these steps:
-
Use the
onprem-resources/kubernetes/keycloack/demo-tenant.json
file included in this repository as the initial realm for your Keycloak instance. -
Log in to the Keycloak frontend and navigate to the import section on the left side.
-
Import the
demo-tenant.json
file to create the initial realm for your Keycloak instance.
You have now successfully deployed Keycloak and Postgres as dependencies for the ENAPSO SDK on your Kubernetes platform. If you have any questions or concerns, please contact your support team.