doc-exports/docs/cce/umn/cce_bestpractice_0348.html
Dong, Qiu Jian f7b9a88535 CCE UMN update -20240625 version
Reviewed-by: Kovács, Zoltán <zkovacs@t-systems.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2024-09-04 11:43:54 +00:00

3.3 KiB

Optimizing Domain Name Resolution Requests

DNS resolution is frequently used in Kubernetes clusters. Based on the characteristics of DNS resolution in Kubernetes, you can optimize domain name resolution requests in the following ways.

Using a Connection Pool

When a containerized application needs to frequently request another service, you are advised to use a connection pool. The connection pool can cache the link information of the upstream service to avoid the overhead of DNS resolution and TCP link reestablishment for each access.

Optimizing the resolve.conf File in the Container

The ndots and search parameters in the resolve.conf file determine the domain name resolution efficiency. For details about the two parameters, see DNS Configuration.

Optimizing the Domain Name Configuration

When a container needs to access a domain name, configure the domain name based on the following rules to improve the domain name resolution efficiency.
  1. When a pod accesses a Service in the same namespace, use <service-name>, which indicates the Service name.
  2. When a pod accesses a Service across namespaces, use <service-name>.<namespace-name>. namespace-name indicates the namespace where the Service is located.
  3. When a pod accesses an external domain name of a cluster, it uses the FQDN domain name. This type of domain name is specified by adding a period (.) at the end of a common domain name to avoid multiple invalid search attempts caused by search domain combination.