I just follow the Keycloak Documentation for Kubernetes.
https://www.keycloak.org/getting-started/getting-started-kube
But After deployed it like exactly how they are saying in the documentation.
When I try to load the keyclaok page, I'm getting this,
if you can give me a solution or explain why this is happening, Really appreciate it!
My ingress config (keycloak-ingress.yaml) is,
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: keycloak
spec:
tls:
- hosts:
- keycloak.192.168.49.2.nip.io
rules:
- host: keycloak.192.168.49.2.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: keycloak
port:
number: 8080
Make sure you have updated the ingress file with the proper IP of minikube.
Also check with http instead https & KEYCLOAK_HOSTNAME value
Try below YAML :
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
spec:
ports:
- name: http
port: 8080
targetPort: 8080
selector:
app: keycloak
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: keycloak
labels:
app: keycloak
spec:
replicas: 1
selector:
matchLabels:
app: keycloak
template:
metadata:
labels:
app: keycloak
spec:
containers:
- name: keycloak
image: quay.io/keycloak/keycloak:20.0.3
args: ["start-dev"]
env:
- name: KEYCLOAK_ADMIN
value: "admin"
- name: KEYCLOAK_ADMIN_PASSWORD
value: "admin"
- name: KC_PROXY
value: "edge"
ports:
- name: http
containerPort: 8080
readinessProbe:
httpGet:
path: /realms/master
port: 8080
it will creat the LB service for you so you will be able to access it without ingress config. Run kubectl get svc -n <namespace-name>
and check External IP and try opening that in browser.
Extra :
You can refer to this YAML if the default one is not working. i am using Postgres & Dpeloying the Keycloak with that.
GitHub repo path : https://github.com/harsh4870/Keycloack-postgres-kubernetes-deployment
Ref : https://faun.pub/keycloak-kubernetes-deployment-409d6ccd8a39