在 kubernetes 环境中 Ping api,在其他命名空间中是 运行
Ping api in kubernetes environment which is running in other namespaces
如何在其他命名空间中的 kubernetes 环境中 ping 我的 api,即 运行,而不是默认值。假设我在 3 个命名空间中有 pods 运行 - default、dev、prod。我安装了入口负载均衡器并配置了路由。我在访问默认命名空间时没有问题 - https://localhost/myendpoint...但是如何访问其他命名空间(例如 dev 或 prod)中 运行 不同图像版本的 apis?我是否需要在服务或入口服务文件中添加额外的配置?
编辑:我的 pods 是 restful api,它们通过 http 请求进行通信。我只是问如何访问我在其他命名空间而不是默认命名空间中运行的 pod。部署之间相互通信没有问题。假设我有一个前端应用程序 运行 并且想从浏览器访问它,它是如何完成的?如果 pods 在默认命名空间中,我可以通过点击 http://localhost/path... but if I delete all the pods from default namespace and move all the services and deoloyments into dev namespace, I cannot access it anymore from the browser with the same url. Does it have a specific path for different namespaces like http://localhost/dev/path 来访问吗?我需要cinfigure吗
希望它足够清楚。谢谢
通过 Ingress 将流量路由到服务
当你想将来自外部客户端的请求通过 Ingress
路由到 Service
时,你应该将 Ingress
和 Service
对象放在 相同的命名空间。我建议在您的 Ingress
环境中使用不同的 域 。
将流量从服务路由到服务
当您想要将流量从集群中的 pod 路由到 Service
,可能在另一个命名空间中时,最简单的方法是使用 Service Discovery with DNS,例如发送请求至:
<service-name>.<namespace>.svc.<configured-cluster-name>.<configured-name>
这很有可能
<service-name>.<namespace>.svc.cluster.local
如何在其他命名空间中的 kubernetes 环境中 ping 我的 api,即 运行,而不是默认值。假设我在 3 个命名空间中有 pods 运行 - default、dev、prod。我安装了入口负载均衡器并配置了路由。我在访问默认命名空间时没有问题 - https://localhost/myendpoint...但是如何访问其他命名空间(例如 dev 或 prod)中 运行 不同图像版本的 apis?我是否需要在服务或入口服务文件中添加额外的配置?
编辑:我的 pods 是 restful api,它们通过 http 请求进行通信。我只是问如何访问我在其他命名空间而不是默认命名空间中运行的 pod。部署之间相互通信没有问题。假设我有一个前端应用程序 运行 并且想从浏览器访问它,它是如何完成的?如果 pods 在默认命名空间中,我可以通过点击 http://localhost/path... but if I delete all the pods from default namespace and move all the services and deoloyments into dev namespace, I cannot access it anymore from the browser with the same url. Does it have a specific path for different namespaces like http://localhost/dev/path 来访问吗?我需要cinfigure吗
希望它足够清楚。谢谢
通过 Ingress 将流量路由到服务
当你想将来自外部客户端的请求通过 Ingress
路由到 Service
时,你应该将 Ingress
和 Service
对象放在 相同的命名空间。我建议在您的 Ingress
环境中使用不同的 域 。
将流量从服务路由到服务
当您想要将流量从集群中的 pod 路由到 Service
,可能在另一个命名空间中时,最简单的方法是使用 Service Discovery with DNS,例如发送请求至:
<service-name>.<namespace>.svc.<configured-cluster-name>.<configured-name>
这很有可能
<service-name>.<namespace>.svc.cluster.local