-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- Install Google Cloud SDK. (include kubectl)
- Docker
- Setup GCP project.
- Create PostgreSQL through GCP console.
- Enable "Private IP".
- Go to user -> change user password.
- Goto GCP console
-> click [APIs & Services] and select [Library]
-> Type "Cloud SQL" in search bar.
-> enable "Cloud SQL Admin API" & "Cloud SQL". - Goto GCP console -> click [IAM & admin] -> Service accounts
-> Click [Create Service Account]
-> type service account name with:keycloak-master-> create. - select a role with : Cloud SQL Admin-> continue.
- create key with json type -> save to file.(as key.json)
(currently we use keycloak ver.7.0.0, don't know why not work with v.6.0.1)
export PROJECT_ID="$(gcloud config get-value project -q)"
$ sudo docker pull jboss/keycloak:7.0.0
$ sudo docker tag jboss/keycloak asia.gcr.io/${PROJECT_ID}/keycloak
$ sudo docker push asia.gcr.io/${PROJECT_ID}/keycloak
$ gcloud container clusters create auth-cluster --num-nodes=3
$ gcloud container clusters get-credentials auth-cluster
$ kubectl create secret generic cloudsql-instance-credentials
--from-file=credentials.json="{secret_dir}/key.json"
- Replace DB instance name in proxy/proxy-deployment.yaml
$ kubectl apply -f proxy/
Documentation
*** Here we have our domain host and need GCP to renew ssl certificate automatically.***
*** skip this step if you don't require SSL.***
-
Reserve a global static IP address.
$ gcloud compute addresses create example-auth-ip --global
$ gcloud compute addresses describe example-auth-ip --global -
GCP managed certificate
$ kubectl apply -f certificate/auth-certificate.yaml
$ kubectl describe managedcertificate
Documentation
-
Create Keycloak instances
$ kubectl apply -f keycloak-statefulset.yaml -
Create headless service.
$ kubectl apply -f keycloak-headless.yaml -
Create load balancer
$ kubectl apply -f keycloak-service.yaml -
Expose service via Ingress. (require more than 10 mins)
***delete annotations from ingress.yaml if you don't need ssl. ***
$ kubectl apply -f keycloak-ingress.yaml -
Configure the DNS records for your domain to point to the IP address of the load balancer.(optional)
-
Cluster discovery successful.
10:39:01,203 INFO [org.infinispan.CLUSTER] (thread-101,ejb,keycloak-0) ISPN100000: Node keycloak-2 joined the cluster
10:39:01,205 INFO [org.infinispan.CLUSTER] (thread-101,ejb,keycloak-0) ISPN000094: Received new cluster view for channel ejb: [keycloak-0|14] (4) [keycloak-0, keycloak-1, keycloak-3, keycloak-2]