gpt4 book ai didi

Kubernetes 上的 docker 类似 "links"

转载 作者:行者123 更新时间:2023-12-02 04:23:22 27 4
gpt4 key购买 nike

我正在 Kubernetes 中部署 5 个 docker 容器拓扑,其中一个容器是 RabbitMQ 容器 X,每个其他容器都有到该容器的链接。在 Y 和 X(兔子)之间建立链接后,Y 在主机文件中具有新的 DNS 记录,以便通过名称访问该容器。现在我正在迁移到 Kubernetes,是否可以通过名称访问 (ping) 其他容器?我错过了什么吗?

最佳答案

您可能想要为 RabbitMQ 的部署创建一个 Service 对象。可以从集群内通过 DNS 中的名称访问它。

If you have a Service called "my-service" in Kubernetes Namespace "my-ns" a DNS record for "my-service.my-ns" is created. Pods which exist in the "my-ns" Namespace should be able to find it by simply doing a name lookup for "my-service"

有关更多信息,请参阅docs .

关于Kubernetes 上的 docker 类似 "links",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44204696/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com