forked from docs/doc-exports
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>
3.3 KiB
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.
- When a pod accesses a Service in the same namespace, use <service-name>, which indicates the Service name.
- When a pod accesses a Service across namespaces, use <service-name>.<namespace-name>. namespace-name indicates the namespace where the Service is located.
- 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.
Parent topic: Client