Help & Documentation>Tencent Kubernetes Engine

NodeLocalDNSCache

Last updated: 2023-09-26 15:10:45

Feature Overview

Component Description

NodeLocal DNSCache runs on cluster nodes in the form of a DaemonSet and as a DNS cache proxy to enhance the DNS performance of clusters. In the current system architecture, pods in ClusterFirst DNS mode can connect to kube-dns serviceIP to perform DNS query and be converted to kube-dns/CoreDNS endpoints according to the iptables rules added by kube-proxy. In this new architecture, pods can access the DNS cache proxy running on the same node to eliminate the need of configuring iptables DNAT rules and connection tracking. The local cache proxy queries the kube-dns service to retrieve the cache loss of the cluster host name (suffixed with cluster.local by default).

Kubernetes objects deployed within a cluster

Kubernetes Object Name
Local Disk Types
Requested Resource
Namespace
node-local-dns
DaemonSet
Per node: 50M CPU and 5Mi memory
kube-system
kube-dns-upstream
Service
-
kube-system
node-local-dns
ServiceAccount
-
kube-system
node-local-dns
Configmap
-
kube-system

Limits

This add-on is supported only by Kubernetes 1.14 or later versions.
VPC-CNI supports both the iptables and IPVS modes of kube-proxy. GlobalRouter only supports the iptables mode, and in order for it to support the IPVS mode, the kubelet parameters need to be changed. For more information, see Using NodeLocal DNSCache in Kubernetes clusters.
For relevant names and labels for which the workloads corresponding to the DNS service have not been adjusted since cluster creation, check that the following workloads related to the DNS service exist under the kube-system namespace of the cluster:
service/kube-dns
deployment/kube-dns or deployment/coredns, with the "k8s-app: kube-dns" label
For self-deployed clusters in IPVS mode, make sure that the add-pod-eni-ip-limit-webhook ClusterRole has the following permissions:
- apiGroups:
- ""
resources:
- configmaps
- secrets
- namespaces
- services
verbs:
- list
- watch
- get
- create
- update
- delete
- patch
For self-deployed and managed clusters in IPVS mode, make sure that the version of the add-pod-eni-ip-limit-webhook Deployment image under the tke-eni-ip-webhook namespace is greater than or equal to v0.0.6.

Recommended configuration

After installing NodeLocal DNSCache, we recommend you add the following configuration to CoreDNS:
template ANY HINFO . {
rcode NXDOMAIN
}
forward . /etc/resolv.conf {
prefer_udp
}

Instructions

1. Log in to the TKE console and select Cluster in the left sidebar.
2. On the "Cluster Management" page, click the ID of the target cluster to enter the cluster details page.
3. Select Component Management from the left sidebar menu to access the "Component List" page.
4. In the "Component List" page, select Create and check NodeLocalDNSCache in the "Create Component" page. For detailed configuration of NodeLocalDNSCache, please refer to the official documentation.
5. Click Done to complete the process.