连接被拒绝,尝试在成功部署到Kubernetes后加载Keycloak时在浏览器上。

huangapple go评论88阅读模式
英文:

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,

  1. apiVersion: networking.k8s.io/v1
  2. kind: Ingress
  3. metadata:
  4. name: keycloak
  5. spec:
  6. tls:
  7. - hosts:
  8. - keycloak.192.168.49.2.nip.io
  9. rules:
  10. - host: keycloak.192.168.49.2.nip.io
  11. http:
  12. paths:
  13. - path: /
  14. pathType: Prefix
  15. backend:
  16. service:
  17. name: keycloak
  18. port:
  19. number: 8080
英文:

I just follow the Keycloak Documentation for Kubernetes.

https://www.keycloak.org/getting-started/getting-started-kube

连接被拒绝,尝试在成功部署到Kubernetes后加载Keycloak时在浏览器上。

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,

连接被拒绝,尝试在成功部署到Kubernetes后加载Keycloak时在浏览器上。

if you can give me a solution or explain why this is happening, Really appreciate it!

My ingress config (keycloak-ingress.yaml) is,

  1. apiVersion: networking.k8s.io/v1
  2. kind: Ingress
  3. metadata:
  4. name: keycloak
  5. spec:
  6. tls:
  7. - hosts:
  8. - keycloak.192.168.49.2.nip.io
  9. rules:
  10. - host: keycloak.192.168.49.2.nip.io
  11. http:
  12. paths:
  13. - path: /
  14. pathType: Prefix
  15. backend:
  16. service:
  17. name: keycloak
  18. port:
  19. number: 8080

答案1

得分: 1

请确保您已更新入口文件的正确minikubeIP

还要检查http而不是https以及KEYCLOAK_HOSTNAME的值。

尝试以下YAML:

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: keycloak
  5. labels:
  6. app: keycloak
  7. spec:
  8. ports:
  9. - name: http
  10. port: 8080
  11. targetPort: 8080
  12. selector:
  13. app: keycloak
  14. type: LoadBalancer
  15. ---
  16. apiVersion: apps/v1
  17. kind: Deployment
  18. metadata:
  19. name: keycloak
  20. labels:
  21. app: keycloak
  22. spec:
  23. replicas: 1
  24. selector:
  25. matchLabels:
  26. app: keycloak
  27. template:
  28. metadata:
  29. labels:
  30. app: keycloak
  31. spec:
  32. containers:
  33. - name: keycloak
  34. image: quay.io/keycloak/keycloak:20.0.3
  35. args: ["start-dev"]
  36. env:
  37. - name: KEYCLOAK_ADMIN
  38. value: "admin"
  39. - name: KEYCLOAK_ADMIN_PASSWORD
  40. value: "admin"
  41. - name: KC_PROXY
  42. value: "edge"
  43. ports:
  44. - name: http
  45. containerPort: 8080
  46. readinessProbe:
  47. httpGet:
  48. path: /realms/master
  49. 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 :

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: keycloak
  5. labels:
  6. app: keycloak
  7. spec:
  8. ports:
  9. - name: http
  10. port: 8080
  11. targetPort: 8080
  12. selector:
  13. app: keycloak
  14. type: LoadBalancer
  15. ---
  16. apiVersion: apps/v1
  17. kind: Deployment
  18. metadata:
  19. name: keycloak
  20. labels:
  21. app: keycloak
  22. spec:
  23. replicas: 1
  24. selector:
  25. matchLabels:
  26. app: keycloak
  27. template:
  28. metadata:
  29. labels:
  30. app: keycloak
  31. spec:
  32. containers:
  33. - name: keycloak
  34. image: quay.io/keycloak/keycloak:20.0.3
  35. args: [&quot;start-dev&quot;]
  36. env:
  37. - name: KEYCLOAK_ADMIN
  38. value: &quot;admin&quot;
  39. - name: KEYCLOAK_ADMIN_PASSWORD
  40. value: &quot;admin&quot;
  41. - name: KC_PROXY
  42. value: &quot;edge&quot;
  43. ports:
  44. - name: http
  45. containerPort: 8080
  46. readinessProbe:
  47. httpGet:
  48. path: /realms/master
  49. 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 &lt;namespace-name&gt; 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

huangapple
  • 本文由 发表于 2023年2月10日 14:43:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75407718.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定