Kubelet clusterDNS参数

网友投稿 1457 2022-11-30

Kubelet clusterDNS参数

Kubelet clusterDNS参数

Kubelet config file -- > clusterDNS

clusterDNS:

- "10.32.0.10"

The above is a flag passed to the kubelet file, i dont know what it refers to clsuter DNS ? Is it refers to VPC CIDR or any subnet CIDR ?

1 Answer

​​Active​​​​Oldest​​​​Score​​

It is the address of the DNS server (probably CoreDNS but possibly kube-dns) for the cluster.

它是集群的 DNS 服务器地址(可能是 CoreDNS,也可能是 kube-dns)

Kubernetes uses a DNS server within the cluster so pods can find each other using service names. This is the "cluster DNS" server. Every time a service is created, it gets registered in the DNS server.

Kubernetes 在集群中使用 DNS 服务器,因此 pod 可以使用服务名称找到彼此。这是“集群 DNS”服务器。每次创建服务时,它都会在 DNS 服务器中注册。

In Linux, the ​​/etc/resolv.conf​​​ file is where the DNS server is configured. If you want to use Google's public DNS server (8.8.8.8) your ​​/etc/resolv.conf​​​ file has the entry ​​nameserver 8.8.8.8​​.

在 Linux 中,该​​/etc/resolv.conf​​​文件是配置 DNS 服务器的位置。如果您想使用 Google 的公共 DNS 服务器 (8.8.8.8),您的​​/etc/resolv.conf​​​文件包含​​nameserver 8.8.8.8​​.

In Kubernetes, the kubelet process on a worker node configures each pod. Part of the configuration process is to create the file ​​/etc/resolv.conf​​​ and specify the correct DNS server. That server is spec'ed by the ​​clusterDNS​​ configuration option.

在 Kubernetes 中,工作节点上的 kubelet 进程配置每个 pod。配置过程的一部分是创建文件​​/etc/resolv.conf​​​并指定正确的 DNS 服务器。该服务器由​​clusterDNS​​配置选项指定。

How you set it (if you even need to set it yourself) depends on how you're installing kubernetes. It ultimately depends on the CNI provider you're using, but also if you're doing "kubernetes the hard way" versus ​​kubeadm​​.

在我们安装Kubernetes集群的时候就已经安装了kube-dns插件,这个插件也是官方推荐安装的。通过将 Service 注册到 DNS 中,Kuberentes 可以为我们提供一种简单的服务注册发现与负载均衡方式。

​​CoreDNS​​作为CNCF中的托管的一个项目,在Kuberentes1.9版本中,使用kubeadm方式安装的集群可以通过以下命令直接安装CoreDNS。

kubeadm init --feature-gates=CoreDNS=true

您也可以使用CoreDNS替换Kubernetes插件kube-dns,可以使用 Pod 部署也可以独立部署,请参考​​Using CoreDNS for Service Discovery​​,下文将介绍如何配置kube-dns。

本文已归档到​​kubernetes-handbook​​中。

ClusterDNS和服务发现

Kubernetes 系统之上用于名称解析和服务发现的ClusterDNS是集群的核心附件之一,集群中创建的每个Service对象,都会尤其自动生成相关的资源记录。默认情况下,集群内各Pod资源会自动配置其作为名称解析服务器,并在其DNS搜索中包含它所属名称空间的域名后缀。

无论是使用kubeDNS还是CoreDNS,它们提供的基于DNS的服务发现解决方案都会负责解析以下资源记录(Resource Record)类型以实现服务发现。

拥有ClusterIP的Service资源,需要具有以下类型的资源记录。

A记录:​​..svc.. IN A ​​SRV记录:​​_._...svc.. IN SRV ..svc.​​PTR记录:​​....in-addr.arpa. IN PTR ..svc.​​

Headless 类型的Service资源,需要具有以下类型的资源记录。

A记录:​​..svc.. IN A ​​SRV记录:​​_._...svc.. IN SRV ...svc.​​PTR记录:​​....in-addr.arpa. IN PTR ...svc.​​

ExternalName 类型的Service资源,需要具有CNAME类型的资源记录。

CNAME记录:​​..svc.. IN CNAME ​​

名称解析和服务发现是Kubernetes系统许多功能得以实现的基础服务,它通常是集群安装完成后应该立即部署的附加组件。使用kubeadm初始化一个集群时,它甚至会自动进行部署。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:PromQL Metrics 指标类型 Counter(计数器)、Gauge(仪表盘)、Histogram(直方图)、Summary(摘要)
下一篇:PromQL 演示服务
相关文章

 发表评论

暂时没有评论,来抢沙发吧~