【问题标题】:Helm, Kubernetes, how to configure Pod to access a service outside the cluster?Helm, Kubernetes, how to configure Pod to access a service outside the cluster?
【发布时间】:2022-12-01 14:50:49
【问题描述】:

There is a lot of sources that clarify how to connect into the cluster. But when searching for information about how to connect from inside the cluster to outside the search results are polluted with the opposite information.

I want to connect my custom service that is running inside the cluster to my keycloack that is outside of the cluster on my local machine. There is no option of running keycloak inside the cluster. I am using Docker desktop for Mac to run kubernetes.

【问题讨论】:

    标签: kubernetes kubernetes-helm kubernetes-pod


    【解决方案1】:

    There is no option of running keycloak inside the cluster.

    Not sure may you have checked or not, you can run thekeycloakon the Kubernetes.

    You can refer my Github repo to get YAML files and deployment keycloak on Kubernetes : https://github.com/harsh4870/Keycloack-postgres-kubernetes-deployment

    Generally, you can use theexternalservice, if you are diverting the traffic out of the cluster.

    If you are running on a Public K8s cluster on any cloud provider service will be directly able to access the external service over IP without external service creation.

    Example

    apiVersion: v1
    kind: Service
    metadata:
      name: local-host
    spec:
        type: ExternalName
        externalName: 192.168.0.1
    

    If you don't want to pass the IP in external service you can give any domain name map details in/etc/hostsfiles too. ref doc

    Now if you Keycloak is running on Host machine (localhost) you can use the IP directly.

    If you are using theminikubeyou can use the host.minikube.internal as host. ref doc

    host.minikube.internal:<Port of keycloak>
    

    【讨论】:

    • Thank you, I will try it out.
    猜你喜欢
    • 2022-11-09
    • 2022-12-28
    • 2023-02-01
    • 2022-12-02
    • 2022-12-02
    • 2022-12-02
    • 2022-12-01
    • 2022-12-02
    • 2022-11-09
    相关资源
    最近更新 更多