[英]Helm, Kubernetes, how to configure Pod to access a service outside the cluster?
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.我想将在集群内运行的自定义服务连接到本地计算机上集群外的 keycloack。 There is no option of running keycloak inside the cluster.
没有在集群内运行 keycloak 的选项。 I am using Docker desktop for Mac to run kube.netes.
我正在使用 Docker Mac 桌面来运行 kube.netes。
There is no option of running keycloak inside the cluster.
没有在集群内运行 keycloak 的选项。
Not sure may you have checked or not, you can run the keycloak on the Kube.netes.不确定你是否检查过,你可以在Kube.netes上运行 keycloak。
You can refer my Github repo to get YAML files and deployment keycloak on Kube.netes: https://github.com/harsh4870/Keycloack-postgres-kube.netes-deployment你可以参考我的 Github repo 在 Kube.netes 上获取 YAML 文件和部署密钥斗篷: https://github.com/harsh4870/Keycloack-postgres-kube.netes-deployment
Generally, you can use the external service, 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.如果您在任何云提供商的公共 K8s 集群上运行,服务将能够直接通过 IP 访问外部服务,而无需创建外部服务。
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/hosts files too.如果您不想在外部服务中传递 IP,您也可以在/etc/hosts文件中提供任何域名 map 的详细信息。 ref doc
参考文档
Now if you Keycloak is running on Host machine (localhost) you can use the IP directly.现在,如果您的 Keycloak 在主机(本地主机)上运行,您可以直接使用 IP。
If you are using the minikube you can use the host.minikube.internal
as host.如果您使用的是minikube ,则可以使用
host.minikube.internal
作为主机。 ref doc参考文档
host.minikube.internal:<Port of keycloak>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.