NodeLocalDNS#
NodeLocalDNS runs a local DNS caching agent on each node in the MKE cluster, improving performance by caching DNS responses locally and reducing latency compared to resolving external DNS records through a centralized CoreDNS service.
Prerequisites#
Before installing the NodeLocalDNS in an MKE 4k cluster, you must verify that:
- The custom CNI provider is not enabled.
- kube-proxy is running in iptables mode.
Configuration#
NodeLocalDNS is configured through the spec.nodeLocalDNS section of the mke4.yaml
configuration file. The function is disabled by default, and thus to enable
NodeLocalDNS, you must set the spec.nodeLocalDNS.enabled parameter to true.
NodeLocalDNS example configuration:
nodeLocalDNS:
enabled: false
nodeLocalConfigPersist: false
resources:
requests: {}
| Parameter | Description | Default | Equivalent MKE 3 parameter |
|---|---|---|---|
enabled |
Enables the NodeLocalDNS service in the cluster. Valid values: true, false |
false |
[cluster_config.node_local_dns] |
nodeLocalConfigPersist |
Retains the NodeLocalDNS configmap. | false |
[cluster_config.node_local_dns_config_persist] |
resources.requests.cpu |
Specifies the minimum CPU to guarantee for the NodeLocalDNS container. | 25m |
N/A |
resources.requests.memory |
Specifies the minimum memory to guarantee for the NodeLocalDNS container. | 5Mi |
N/A |
To configure NodeLocalDNS:
-
Obtain the default
mke4.yamlconfiguration file:mkectl init -
In the
mke4.yamlconfiguration file, add thenodeLocalDNSsection underspecand set theenabledparameter totrue, as nodelocalDNS is disabled by default. -
Apply the configuration:
mkectl apply -f mke4.yaml -
Verify the successful deployment of NodeLocalDNS in the cluster:
kubectl get all,configmap -n kube-system | grep nodeExample output:
pod/node-local-dns-7z5k9 1/1 Running 0 4m23s pod/node-local-dns-8wgzc 1/1 Running 0 4m23s pod/node-local-dns-xnr7q 1/1 Running 0 4m23s service/node-local-dns ClusterIP None <none> 9253/TCP 4m24s daemonset.apps/node-local-dns 3 3 3 3 3 kubernetes.io/os=linux 4m24s configmap/node-local-dns 1 4m47s