大网数据广告活动
服务器运维问答

Why configure non-default cluster domain

· 52CE 我爱测

I'm considering to deploy Kubernetes cluster to semi-production usage. So far I've got a good grasp, but there's one thing that I don't fully understand yet. By default Kubernetes uses cluster.local domain for its internal DNS. I…

问题原文

原帖链接 · vbezhenar · CC BY-SA 4.0

I'm considering to deploy Kubernetes cluster to semi-production usage. So far I've got a good grasp, but there's one thing that I don't fully understand yet. By default Kubernetes uses cluster.local domain for its internal DNS. It is possible at installation time to change that default. I own a domain and I can configure it to cluster.mydomain.com, but what would be a good reason to do so? I'm asking because I expect it to be hard to change later, so I want to properly configure it now.

已采纳解答

原帖链接 · SYN · CC BY-SA 4.0

By default Kubernetes uses cluster.local domain for its internal DNS. It is possible at installation time to change that default.

Yes, it is.

Depends on how you would deploy Kubernetes ... Using kubespray, we would do this setting the cluster_name variable. It would change some configuration in the kubeadm-config file used during cluster deployment, as well as cluster DNS zones configuration.

I own a domain and I can configure it to cluster.mydomain.com, but what would be a good reason to do so?

I am not sure changing the cluster internal DNS domain name matching another existing domain would make much sense.

Hypothetically...

  • assuming your SDN connects to some external routers, exposing SDN ranges (through BGP, OSPF, ... eg: using calico) such as users within your LAN can connect to SDN IP addresses.

  • and granted that you did setup your mydomain.com zone, with some cluster IN NS <kubernetes-dns-service-clusterip>, such as clients resolving names corresponding to your cluster services, would get an answer from the cluster DNS itself.

Then, it could make sense. Arguably. As end-users may consistently rely on those DNS names connecting to in-SDN services.

Although this really isn't a common use case. Never seen this myself. And probably not something we should recommend: SDN is meant to isolate your cluster network. Ingresses/service mesh ingress gateways/... would be the preferred way to expose services to end-users: normalizes tls configuration, filter which endpoints can be accessed, maybe log external accesses from a few selected pods/ingresses, ...

Unless you purposefully want end-users to directly connect kubernetes Services ClusterIPs, it probably doesn't make sense to use your own domain, as kubernetes internal DNS domain name.

And when in that case, a better solution may be to investigate solutions such as MetalLB, or Multus. Instead of exposing your SDN to end-users, prefer using one of those exposing specific Services or Deployments, allocating them with addresses outside of your SDN ranges.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-07-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。