NodeLocal DNS Cache helps reduce the load on DNS queries within a Kubernetes cluster. NodeLocal DNS enhances the stability of DNS name resolution, which in turn can avoid DNAT rules, connection tracking, and connection count limits.
начало внимание
For Kubernetes clusters deployed on the Deckhouse platform, the installation of NodeLocal DNS is not required. In this case, use the built-in module.
конец внимание
The installation consists of four steps:
- Get the IP address of the kube-dns service.
- Download the Helm chart and configuration file.
- Fill out the configuration file.
- Install the Node Local DNS chart using Helm in the Kubernetes cluster.
Step 1: Get the IP address of the kube-dns service
The kube-dns service is typically located in the namespace kube-system
of the Kubernetes cluster.
Determine the IP address of the kube-dns service by executing the command:
kubectl get svc kube-dns -n kube-system -o jsonpath={.spec.clusterIP}
The result of the command should be the IP address, which will be used in Step 3. In the context of this article, the result of the command is the IP address 172.20.0.10.
Step 2: Download the Helm chart and configuration file
For installation via the internet, obtain the configuration file values-nodelocal-dns.yaml
by executing the command:
helm repo add elma365 https://charts.elma365.tech
helm repo update
helm show values elma365/node-local-dns > values-nodelocal-dns.yaml
Getting the configuration file for installation in a closed-loop environment without internet access
helm repo add elma365 https://charts.elma365.tech For more details, see Download BRIX images.
tar -xf node-local-dns-X.Y.Z.tgz |
Step 3: Fill out the configuration file
Fill out the configuration file values-nodelocal-dns.yaml
for the installation of NodeLocal DNS Cache.
## NodeLocal DNS Cache settings
node-local-dns:
config:
## cluster domain
dnsDomain: "cluster.local"
## IP address of kube-dns service
dnsServer: "172.20.0.10"
## IP address for NodeLocal DNS Cache.
localDns: "169.254.20.25"
where:
node-local-dns.config.dnsDomain
is the domain of the Kubernetes cluster;node-local-dns.config.dnsServer
is the IP address of the kube-dns service, obtained in Step 1;node-local-dns.config.localDns
is the local IP address for NodeLocal DNS Cache.
To connect to the private registry, you need to:
## NodeLocal DNS Cache settings where repository format is:
|
Step 4: Install the Node Local DNS chart using Helm in the Kubernetes cluster
Perform the installation of the Node Local DNS chart in namespace kube-system
.
For online installation:
helm upgrade --install nodelocaldns elma365/node-local-dns -f values-nodelocal-dns.yaml -n kube-system
For offline installation without internet access:
helm upgrade --install nodelocaldns ./node-local-dns -f values-nodelocal-dns.yaml -n kube-system
Delete Node Local DNS chart using helm in the Kubernetes cluster
To remove the Node Local DNS chart in namespace kube-system
, execute the command:
helm uninstall nodelocaldns -n kube-system