且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 Kubernetes DNS 用于 Pod?

更新时间:2022-04-12 10:35:50

UPDATE

根据文档,现在的格式是:

According to the docs, the format is now:

_my-port-name._my-port-protocol.my-svc.my-namespace.svc.cluster.local

在此处查看相关文档:https://kubernetes.io/docs/concepts/services-网络/dns-pod-service/#pods

原始答案:

截至目前,这实际上是不可能的……但 Kubernetes 团队正在研究它.

as of this date, this is actually not possible... but it is being looked at by the Kubernetes team.

看到这个问题:https://github.com/kubernetes/kubernetes/issues/13552

更新:

DNS 自 09/2015 起可用于 Pod参见 PR:https://github.com/kubernetes/kubernetes/pull/13759

DNS is available for Pods since 09/2015 See PR:https://github.com/kubernetes/kubernetes/pull/13759

简而言之:

这将以 pods 的形式提供 dns..pod. 目前可以禁用,但是为所有 Pod 开启或关闭.

This will give pods dns in the form of <podIP>.<namespace>.pod.<clusterSuffix> Currently can be disabled, but is either on for all pods or off.