英文:
Connection Refused when trying to load keycloak on the browser after deployed it on Kubernetes successfully
问题
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 Keycloak 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
英文:
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
答案1
得分: 1
请确保您已更新入口文件的正确minikube的IP。
还要检查http而不是https以及KEYCLOAK_HOSTNAME的值。
尝试以下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
它将为您创建LB服务,这样您将能够在没有入口配置的情况下访问它。运行 kubectl get svc -n <namespace-name>
并检查外部IP,然后尝试在浏览器中打开它。
额外信息:
如果默认的YAML不起作用,您可以参考此YAML。我正在使用Postgres并使用它部署Keycloak。
GitHub存储库路径:https://github.com/harsh4870/Keycloack-postgres-kubernetes-deployment
参考:https://faun.pub/keycloak-kubernetes-deployment-409d6ccd8a39
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论