Files
doc-exports/docs/cce/umn/cce_bestpractice_0348.html
qiujiandong1 ab1e53a279 CCE UMN 20251031 version
Reviewed-by: Gergo-Bence Lorincz <a200452876@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2026-01-15 10:25:22 +00:00

21 lines
3.4 KiB
HTML

<a name="cce_bestpractice_0348"></a><a name="cce_bestpractice_0348"></a>
<h1 class="topictitle1">Optimizing Domain Name Resolution Requests</h1>
<div id="body8662426"><p id="cce_bestpractice_0348__en-us_topic_0000001320433898_p136mcpsimp">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.</p>
<div class="section" id="cce_bestpractice_0348__section15301716171315"><h4 class="sectiontitle">Using a Connection Pool</h4><p id="cce_bestpractice_0348__p189313559122">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.</p>
</div>
<div class="section" id="cce_bestpractice_0348__section210522416131"><h4 class="sectiontitle">Optimizing the resolve.conf File in the Container</h4><p id="cce_bestpractice_0348__p115951659121216">The settings of <strong id="cce_bestpractice_0348__b15322155291012">ndots</strong> and <strong id="cce_bestpractice_0348__b1732215524102">search</strong> in <strong id="cce_bestpractice_0348__b1932210529104">resolve.conf</strong> determine the domain name resolution efficiency. For details about the two parameters, see <a href="cce_10_0365.html">DNS Configuration</a>.</p>
</div>
<div class="section" id="cce_bestpractice_0348__section1932010312139"><h4 class="sectiontitle">Optimizing the Domain Name Configuration</h4><div class="p" id="cce_bestpractice_0348__p1329272111315">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.<ol id="cce_bestpractice_0348__en-us_topic_0000001320433898_ol141mcpsimp"><li id="cce_bestpractice_0348__en-us_topic_0000001320433898_li142mcpsimp">When a pod accesses a Service in the same namespace, use <em id="cce_bestpractice_0348__i585210105235">&lt;service-name&gt;</em>, which indicates the Service name.</li><li id="cce_bestpractice_0348__en-us_topic_0000001320433898_li143mcpsimp">When a pod accesses a Service across namespaces, use <em id="cce_bestpractice_0348__i16312132842714">&lt;service-name&gt;.&lt;namespace-name&gt;</em>. <em id="cce_bestpractice_0348__i943115334437">&lt;namespace-name&gt;</em> indicates the namespace where the Service is located.</li><li id="cce_bestpractice_0348__en-us_topic_0000001320433898_li144mcpsimp">When a pod accesses a domain name outside the cluster, it uses the FQDN domain name. This type of domain name is specified by adding a period (.) at the end of a typical domain name to avoid multiple invalid search attempts caused by search domain combination.</li></ol>
</div>
</div>
<div class="section" id="cce_bestpractice_0348__section949810382137"><h4 class="sectiontitle">Using Local Cache</h4><p id="cce_bestpractice_0348__p152301555139">If the cluster specifications are large and the number of DNS resolution requests is large, you can cache the DNS resolution result on the node. You are advised to use NodeLocal DNSCache. For details, see <a href="cce_10_0362.html">Using NodeLocal DNSCache to Improve DNS Performance</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_bestpractice_0347.html">Client</a></div>
</div>
</div>