Cloud Container Service Engine (CCSE)

Service Discovery Based on DNS

2025-07-10 10:07:52

DNS provides domain resolution services for workloads within the Kubernetes cluster. This section mainly introduces the DNS domain resolution principle in the Kubernetes cluster and CoreDNS, the default built-in DNS server in the CCSE cluster.

  • DNS Domain Resolution Principle in a Kubernetes Cluster

In config.yaml of the kubelet in the CCSE cluster, the clusterDNS and clusterDomain parameters are used to set the IP address of the cluster DNS server and the primary domain name suffix respectively.

A set of CoreDNS workloads is deployed by default in the CCSE cluster, and the DNS service is exposed through the kube-dns service name. The back-end of the CoreDNS workload deployed by CCSE is two Pods named "coredns". The cluster will send the domain name request to the cluster DNS server for resolution based on the configuration in the Pod. The DNS domain resolution configuration file in the Pod is /etc/resolv.conf. The content of the file is as follows.

nameserver 10.xx.x.xx

search   kube-system.svc.cluster.local svc.cluster.local cluster.local

options ndots:5

 

S/N

Description

1

When the Pod Client attempts   to access the Service Nginx, it first queries the local DNS configuration   file (/etc/resolv.conf) for the DNS server (nameserver 10.96.0.10, i.e.,   Service kube-dns) to obtain the service IP address. The resolved IP address   is 10.96.1.2.

2

The Pod Client then directly   requests this IP address. The request is eventually forwarded by the Service   Nginx to the back-end Nginx containers (Pod Nginx-1 and Pod Nginx-2).

 

  • CoreDNS Introduction

CoreDNS is the DNS resolution component in a Kubernetes cluster, capable of resolving both custom service domain names within the cluster and external domain names. CoreDNS offers a rich set of plug-ins, supporting custom DNS, custom hosts, CNAME, rewrite, and other needs at the cluster level. Like Kubernetes, the CoreDNS project is hosted by CNCF. For more information about CoreDNS, refer to CoreDNS: DNS and Service Discovery.

The CCSE cluster uses CoreDNS for service discovery within the cluster. You can configure CoreDNS and use CoreDNS to enhance the DNS QPS performance of the cluster according to different usage scenarios.


JdesX3kNVWv4