Alibaba DNS Cache is a kernel-based DNS caching component for Container Compute Service (ACS) clusters. It is intrusion-free, high-performance, and low-overheads. It reduces cross-node DNS traffic and lowers DNS query latency for ACS pods without requiring changes to your DNSConfig.
Why use Alibaba DNS Cache
Without a local DNS cache, pods with high DNS query rates may send requests to a DNS service on a different node. This adds network round-trip latency and increases load on CoreDNS. Alibaba DNS Cache addresses this by:
-
Serving cached responses at the pod level, eliminating repeated upstream lookups
-
Reducing cross-node DNS traffic by intercepting queries before they leave the node
-
Operating transparently—no application changes or DNSConfig modifications required
How it works
Alibaba DNS Cache intercepts DNS queries from application pods and serves cached responses. On a cache miss, it routes the query based on the DNS zone configuration:
-
Direct upstream path: The query goes directly to the upstream DNS service. Alibaba DNS Cache caches the result and returns it to the application.
-
CoreDNS path: The query goes to CoreDNS. If CoreDNS also misses, CoreDNS queries the upstream DNS service, caches the response, and returns it to Alibaba DNS Cache, which then returns it to the application.
Limitations
| Limitation | Details |
|---|---|
| Cluster type | ACS clusters only; applies only to ACS pods |
| Supported record types | A, AAAA, and CNAME records |
| Supported transport | UDP-based DNS queries only |
| Maximum response size | 256 bytes |
Install Alibaba DNS Cache
Prerequisites
Before you begin, make sure that you have:
-
An ACS cluster
-
Access to the ACS console with cluster management permissions
Install the component
-
Log on to the ACS console. In the left-side navigation pane, click Clusters.
-
On the Clusters page, click the ID of the cluster you want to manage. In the left-side navigation pane, choose Operations > Add-ons.
-
On the Add-ons page, click the Networking tab and locate the Alibaba DNS Cache component.
-
In the Alibaba DNS Cache card, click Install. In the dialog box that appears, click OK. After Alibaba DNS Cache is installed, DNS queries initiated from ACS pods are accelerated. No additional operation is needed.
ImportantInstalling Alibaba DNS Cache creates a ConfigMap named
blazing-dnsin thekube-systemnamespace. Do not modify or delete this ConfigMap.
Verify the installation
DNS cache acceleration applies only to pods created after the component is installed. Existing pods are not affected.
Run the following command to confirm that new pods have DNS cache acceleration enabled:
kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")].metadata.name}' -A
If the output lists pod names, those pods have DNS cache acceleration enabled. Pods without the network.alibabacloud.com/enable-dns-cache: "true" annotation are not accelerated.
Uninstall Alibaba DNS Cache
Before uninstalling, make sure no running pods are using DNS cache acceleration.
Step 1: Check for pods with DNS cache acceleration enabled
Run one of the following commands depending on whether jq is installed:
Without `jq`:
kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")].metadata.name}' -A
With `jq`:
kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")]}' -A | jq -rc ".metadata.namespace,.metadata.name"
If the output is empty, skip to Step 3. If pods are listed, continue to Step 2.
Step 2: Disable DNS cache acceleration for existing pods
-
On the Clusters page, click the ID of the cluster you want to manage. In the left-side navigation pane, choose Configurations > ConfigMaps.
-
On the ConfigMap page, select the kube-system namespace. In the Actions column for blazing-dns, click Edit. In the panel that appears, set config to
enabled: false. -
Repeat Step 1 and confirm that no pods are returned before continuing.
Step 3: Uninstall the component
-
On the Clusters page, click the ID of the cluster you want to manage. In the left-side navigation pane, choose Operations > Add-ons.
-
On the Add-ons page, click the Networking tab. In the Alibaba DNS Cache card, click Uninstall. In the message that appears, click OK.