Files
doc-exports/docs/cce/umn/cce_bestpractice_0356.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

32 lines
10 KiB
HTML

<a name="cce_bestpractice_0356"></a><a name="cce_bestpractice_0356"></a>
<h1 class="topictitle1">Adjusting the CoreDNS Deployment Status</h1>
<div id="body8662426"><p id="cce_bestpractice_0356__en-us_topic_0000001320433902_p204mcpsimp">In CCE clusters, the CoreDNS add-on is installed by default, and it can run on the same cluster nodes as your service containers. You need to pay attention to the following points when deploying CoreDNS:</p>
<ul id="cce_bestpractice_0356__en-us_topic_0000001320433902_ul205mcpsimp"><li id="cce_bestpractice_0356__en-us_topic_0000001320433902_li206mcpsimp"><a href="#cce_bestpractice_0356__section16223162574313">Properly Changing the Number of CoreDNS Replicas</a></li><li id="cce_bestpractice_0356__en-us_topic_0000001320433902_li207mcpsimp"><a href="#cce_bestpractice_0356__section145912122442">Properly Deploying the CoreDNS Pods</a></li><li id="cce_bestpractice_0356__li1437612241017"><a href="#cce_bestpractice_0356__section973132695212">Deploying CoreDNS Separately Using Custom Parameters</a></li><li id="cce_bestpractice_0356__en-us_topic_0000001320433902_li209mcpsimp"><a href="#cce_bestpractice_0356__section9558185318454">Automatically Expanding the CoreDNS Capacity Based on the HPA</a></li></ul>
<div class="section" id="cce_bestpractice_0356__section16223162574313"><a name="cce_bestpractice_0356__section16223162574313"></a><a name="section16223162574313"></a><h4 class="sectiontitle">Properly Changing the Number of CoreDNS Replicas</h4><p id="cce_bestpractice_0356__en-us_topic_0000001370914077_p211mcpsimp">You are advised to set the number of CoreDNS replicas to at least 2 in any case and keep the number of replicas within a proper range to support the resolution of the entire cluster. The default number of pods for installing the add-on in a CCE cluster is <strong id="cce_bestpractice_0356__b1549112723818">2</strong>.</p>
<ul id="cce_bestpractice_0356__en-us_topic_0000001370914077_ul212mcpsimp"><li id="cce_bestpractice_0356__en-us_topic_0000001370914077_li213mcpsimp">Modifying the number of CoreDNS replicas, CPUs, and memory size will change CoreDNS' parsing capability. Therefore, evaluate the impact before the operation.</li><li id="cce_bestpractice_0356__en-us_topic_0000001370914077_li214mcpsimp">By default, podAntiAffinity (pod anti-affinity) is configured for the add-on. If a node already has a CoreDNS pod, no new pod can be added. That is, only one CoreDNS pod can run on a node. If there are more configured CoreDNS replicas than cluster nodes, the excess pods cannot be scheduled. Therefore, keep the number of replicas less than or equal to the number of nodes.</li></ul>
</div>
<div class="section" id="cce_bestpractice_0356__section145912122442"><a name="cce_bestpractice_0356__section145912122442"></a><a name="section145912122442"></a><h4 class="sectiontitle">Properly Deploying the CoreDNS Pods</h4><ul id="cce_bestpractice_0356__ul5473183224512"><li id="cce_bestpractice_0356__li653610764414">By default, podAntiAffinity (pod anti-affinity) is configured for CoreDNS, so CoreDNS pods are forcibly deployed on different nodes in a cluster. It is recommended that you deploy CoreDNS pods on nodes in different AZs to prevent the add-on from being interrupted by faults in a single AZ.</li><li id="cce_bestpractice_0356__li347313218453">The CPU and memory of the cluster node where the coredns add-on runs must not be used up. Otherwise, the QPS and response of domain name resolution will be affected. It is recommended that you use the custom parameters to <a href="#cce_bestpractice_0356__section973132695212">deploy CoreDNS separately</a>.</li></ul>
</div>
<div class="section" id="cce_bestpractice_0356__section973132695212"><a name="cce_bestpractice_0356__section973132695212"></a><a name="section973132695212"></a><h4 class="sectiontitle">Deploying CoreDNS Separately Using Custom Parameters</h4><p id="cce_bestpractice_0356__p10563384527">It is recommended that CoreDNS be deployed separately from resource-intensive workloads to prevent CoreDNS performance deterioration or unavailability due to service fluctuation. You can customize parameters to deploy CoreDNS on a dedicated node.</p>
<div class="note" id="cce_bestpractice_0356__note191982919531"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="cce_bestpractice_0356__p21981598537">There should be more nodes than CoreDNS pods. You need to avoid deploying multiple CoreDNS pods on a single node.</p>
</div></div>
<ol id="cce_bestpractice_0356__ol0940173685315"><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li79401836115316"><span>Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b1390352725318">Nodes</strong>.</span></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li678620165419"><span>Click the <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b713473875316">Nodes</strong> tab, select the node dedicated for CoreDNS, and click <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b1693412427541">Labels and Taints</strong> above the node list.</span><p><p id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_p282982117573">Add the following labels:</p>
<ul id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_ul1543125311571"><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li144305305716">Key: <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b727215813544">node-role.kubernetes.io/coredns</strong></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li14436539578">Value: <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b87501559105412">true</strong></li></ul>
<p id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_p192372044135814">Add the following taints:</p>
<ul id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_ul18239144420588"><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li1323984418582">Key: <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b12699151419554">node-role.kubernetes.io/coredns</strong></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li19239204435815">Value: <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b2070122116553">true</strong></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li423924412583">Effect: <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b687014193564">NoSchedule</strong></li></ul>
</p></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li37891521506"><span>In the navigation pane, choose <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b11748661571"><span id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_text579014521401">Add-ons</span></strong>, locate <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b125791731105710">CoreDNS</strong>, and click <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b1554033245712">Edit</strong>.</span></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li18940193615534"><span>Select Custom Policies for <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b1667714176588">Node Affinity</strong> and add the preceding node label.</span><p><p id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_p173088466110">Add tolerations for the preceding taint.</p>
</p></li><li id="cce_bestpractice_0356__cce_bestpractice_10027_en-us_topic_0000001371438493_li15265421438"><span>Click <strong id="cce_bestpractice_0356__cce_bestpractice_10027_b8418750135916">OK</strong>.</span></li></ol>
</div>
<div class="section" id="cce_bestpractice_0356__section9558185318454"><a name="cce_bestpractice_0356__section9558185318454"></a><a name="section9558185318454"></a><h4 class="sectiontitle">Automatically Expanding the CoreDNS Capacity Based on the HPA</h4><p id="cce_bestpractice_0356__en-us_topic_0000001319474346_p222mcpsimp">HPA frequently scales down the number of the coredns add-on replicas. Therefore, you are advised not to use HPA. If HPA is required, you can configure HPA auto scaling policies using the CCE Advanced HPA add-on. The process is as follows:</p>
<ol id="cce_bestpractice_0356__ol817112512227"><li id="cce_bestpractice_0356__li717118255222"><span>Log in to the CCE console and click the name of the target cluster to access the cluster console. In the navigation pane, choose <strong id="cce_bestpractice_0356__b6345125319214"><span id="cce_bestpractice_0356__text8414337185914">Add-ons</span></strong>, locate the <strong id="cce_bestpractice_0356__b265619377317">CCE Advanced HPA</strong> add-on on the right, and click <strong id="cce_bestpractice_0356__b1769512438315">Install</strong>.</span></li><li id="cce_bestpractice_0356__li3171725142215"><span>Configure the add-on parameters and click <strong id="cce_bestpractice_0356__b15516413410">Install</strong>.</span></li><li id="cce_bestpractice_0356__li417192519225"><span>In the navigation pane, choose <strong id="cce_bestpractice_0356__b536416581414">Workloads</strong>, select the <strong id="cce_bestpractice_0356__b658362318511">kube-system</strong> namespace, locate the row containing the CoreDNS pod, and click <strong id="cce_bestpractice_0356__b15741849953">Auto Scaling</strong> in the <strong id="cce_bestpractice_0356__b036417451358">Operation</strong> column.</span><p><p id="cce_bestpractice_0356__p5164182602316">In the <strong id="cce_bestpractice_0356__b2880161210545">HPA Policies</strong> area, you can customize HPA policies based on metrics such as CPU usage and memory usage to automatically scale out the CoreDNS pods.</p>
</p></li><li id="cce_bestpractice_0356__li617132515224"><span>Click <span class="uicontrol" id="cce_bestpractice_0356__uicontrol699138172515"><b>Create</b></span>. If the latest status is <strong id="cce_bestpractice_0356__b1741735175511">Started</strong>, the policy has taken effect.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_bestpractice_0354.html">Server</a></div>
</div>
</div>