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.
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
-
This component can only be installed in ACS clusters to improve DNS resolution performance for applications running on 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
-
Log on to the ACS console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of the target cluster. In the left navigation pane, click Add-ons.
-
On the Add-ons page, click the Networking tab, and then find the Alibaba DNS Cache component card.
-
On 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.
-
Acceleration applies only to pods created after the component is installed, not to existing pods. You can verify whether acceleration is enabled for a pod by checking if its
network.alibabacloud.com/enable-dns-cachepod annotation is set to true.
After installation, Alibaba DNS Cache automatically accelerates DNS queries from ACS pods. No further action is required.
-
Uninstall Alibaba DNS Cache
Before you uninstall the Alibaba DNS Cache component, you must ensure that no running pods have DNS acceleration enabled.
-
Check for pods that have DNS acceleration enabled.
JQ is installed
kubectl get pod -o=jsonpath='{.items[?(@.metadata.annotations.network\.alibabacloud\.com/enable-dns-cache=="true")].metadata.name}' -AJQ 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" -
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.
-
On the Clusters page, click the name of the target cluster. In the left navigation pane, choose Configurations > ConfigMaps.
-
On the ConfigMaps page, select the kube-system namespace. Find the row for blazing-dns and click Edit in the Actions column. In the dialog box that appears, change the value of the config field to
enabled: false. -
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.
-
-
Uninstall the component.
-
On the Clusters page, click the name of the target cluster. In the left navigation pane, click Add-ons.
-
On the Add-ons page, click the Networking tab. On the Alibaba DNS Cache component card, click Uninstall. In the dialog box that appears, click OK.
-