All Products
Search
Document Center

Container Compute Service:Use Alibaba DNS cache to improve DNS resolution efficiency

Last Updated:Mar 04, 2025

Container Compute Service (ACS) provides the Alibaba DNS Cache component, which can accelerate DNS cache based on kernel programming technologies to improve the stability and efficiency of DNS service discovery. This topic describes how to install, update, and uninstall the Alibaba DNS Cache component in an ACS cluster.

Introduction to Alibaba DNS Cache

Alibaba DNS Cache is a DNS caching component developed based on kernel programming technologies. It is intrusion-free, high-performance, and low-overheads. After you install the component, application pods can benefit from DNS resolution acceleration immediately. You do not need to modify the DNS servers in the DNSConfig.

image

In the preceding figure:

  • The application sends a query to Alibaba DNS Cache to obtain the domain name resolution result.

  • If the query misses Alibaba DNS Cache, choose one of the following methods based on the zone configuration:

    • Send the query to the upstream DNS service: The upstream DNS service returns the query result to Alibaba DNS Cache. Alibaba DNS Cache caches the result and returns it to the application.

    • Send the query to CoreDNS: If the query misses CoreDNS, the query is sent to the upstream DNS service. The upstream DNS service returns the query result to CoreDNS. CoreDNS caches the result and returns it to Alibaba DNS Cache. Then, Alibaba DNS Cache return the result to the application.

Limits

  • Currently, you can only install the component in ACS clusters to improve the DNS resolution efficiency for ACS pods.

  • Alibaba DNS Cache has the following limits:

    • Supports DNS queries against only A, AAAA, and CNAME records.

    • Supports only UDP-based DNS queries.

    • Supports only DNS queries for which the responses are no larger than 256 bytes.

Install Alibaba DNS Cache

  1. Log on to the ACS console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, find the cluster that you want to manage and click its ID. In the left-side navigation pane of the cluster details page, choose Operations > Add-ons.

  3. On the Add-ons page, click the Networking tab and find the Alibaba DNS Cache component.

  4. In the Alibaba DNS Cache card, click Install. In the dialog box that appears, click OK.

    Important
    • To install Alibaba DNS Cache, the system creates a ConfigMap named blazing-dns in the kube-system namespace. Do not modify or delete the ConfigMap.

    • The acceleration takes effect only on pods that are created after the component is installed. DNS cache acceleration does not take effect on the existing pods. You can check whether the network.alibabacloud.com/enable-dns-cache pod annotation is set to true to determine whether DNS cache acceleration is enabled for the pod.

    After Alibaba DNS Cache is installed, DNS queries initiated from ACS pods are accelerated. No additional operation is needed.

Uninstall Alibaba DNS Cache

Before you uninstall Alibaba DNS Cache, make sure that the running pods are not using DNS cache acceleration.

  1. Run the following command to view pods that have DNS cache acceleration enabled.

    JQ is installed

    kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")].metadata.name}' -A

    JQ is not installed

    kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")]}' -A | jq -rc ".metadata.namespace,.metadata.name"
  2. If the output is not empty, pods that have DNS cache acceleration enabled still exist in the cluster. Perform the following operations to handle these pods.

    1. On the Clusters page, find the cluster that you want to manage and click its ID. In the left-side navigation pane of the cluster details page, choose Configurations > ConfigMaps.

    2. On the ConfigMap page, select the kube-system namespace and click Edit in the Actions column of blazing-dns. In the panel that appears, set config to enabled: false.

    3. Repeat the preceding operation for all pods. Run the command in Step 1 and make sure that no pod is returned. After you handle the pods, perform Step 3 to uninstall the component.

  3. Uninstall the component.

    1. On the Clusters page, find the cluster that you want to manage and click its ID. In the left-side navigation pane of the cluster details page, choose Operations > Add-ons.

    2. On the Add-ons page, click the Networking tab. Find the Alibaba DNS Cache card and click Uninstall. In the message that appears, click OK.