I’m implementing a Keycloak service into a Kubernetes cluster, but I’m not able to open the Keycloak login page which is exposed by Kubernetes.
To do that I’m using Docker Desktop and creating a local cluster with “minikube”. As soon as it’s created I have deployed a postgresql service into the cluster using helm. Finally, I uploaded the deployment and service files to kubernetes. After a while everything was created successfully (as I could see in the Kubernetes Dashboard). So I run the command “minikube service keycloak --url” to open the service in my browser. However, the page keeps loading for a while and then it shows an error which says that the url is not reachable.
I don’t know if the problem is with one of the .yml files or that I have to create a proxy or something similar to access to the internal network that minikube creates. I hope someone knows what is wrong, because I’ve tried a lot of things but none of them worked out.
These are my deployment and services files:
__
apiVersion: apps/v1
kind: Deployment
metadata:
name: keycloak
labels:
name: keycloak
app: keycloak
spec:
replicas: 1
selector:
matchLabels:
app: keycloak
template:
metadata:
name: keycloak
labels:
app: keycloak
name: keycloak
spec:
restartPolicy: Always
containers:
- name: keycloak
image: jboss/keycloak:11.0.2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
protocol: TCP
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 400m
memory: 512Mi
env:
- name: DB_VENDOR
value: “postgres”
- name: KEYCLOAK_LOGLEVEL
value: “DEBUG”
- name: PROXY_ADDRESS_FORWARDING
value: “true”
- name: KEYCLOAK_USER
value: “admin”
- name: KEYCLOAK_PASSWORD
value: “password”
- name: DB_USER
value: “admin”
- name: DB_PASSWORD
value: “password”
- name: DB_ADDR
value: “keycloak-db-postgresql”
- name: DB_PORT
value: “5432”
- name: DB_DATABASE
value: “keycloak-db”
__
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
name: keycloak
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 8080
nodePort: 30080
selector:
app: keycloak
name: keycloak