All Products
Search
Document Center

Container Service for Kubernetes:DNS FAQ

Last Updated:Oct 31, 2023

This topic provides answers to some frequently asked questions about Domain Name System (DNS) resolutions in Container Service for Kubernetes (ACK) clusters.

What do I do if I cannot access a CoreDNS pod by running the exec command?

Problem

You cannot access a CoreDNS pod by running the kubectl -n kube-system exec -it {coredns pod} bash command or a similar command.

Causes

The container image used by the CoreDNS pod is built by using Scratch and does not have a shell.

Solutions

Run the nsenter command to enter the namespace to which the CoreDNS pod belongs. For more information, see Diagnose the network connectivity of the CoreDNS pod. You can monitor CoreDNS by collecting and analyzing the log of CoreDNS. For more information, see Collect and analyze CoreDNS logs.

Why does CoreDNS use deprecated APIs?

Problem

The cluster update precheck result shows that the client whose user agent is coredns uses the deprecated Kubernetes API discovery.k8s.io/v1beta1. The endpoint of the API is /apis/discovery.k8s.io/v1beta1.

Causes

CoreDNS uses the discovery.k8s.io/v1beta1 API to connect to the API server. However, the API is deprecated or will be deprecated in the cluster version that you use. This issue occurs in the following scenarios:

  • An earlier CoreDNS version is installed in the cluster. CoreDNS uses the discovery.k8s.io/v1beta1API because the current version does not support the discovery.k8s.io/v1API.

  • The versions of CoreDNS and Kubernetes are up-to-date. However, CoreDNS is launched in an earlier Kubernetes version, such as 1.20, and the discovery.k8s.io/v1beta1API is selected when ACK launches the CoreDNS pod. Then, the cluster is updated to a Kubernetes version in which the discovery.k8s.io/v1beta1 API is deprecated but CoreDNS still uses the deprecated API.

Solutions

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

  2. On the Clusters page, click the name of the cluster that you want to manage and choose Operations > Add-ons in the left-side navigation pane.

  3. You can update the CoreDNS component from the Add-ons page.

    If the page shows that no update is available, proceed to the next step. Otherwise, perform Step 3. For more information about how to update the CoreDNS component, see Manage components.

  4. Use kubectl to run the following command to restart CoreDNS:

    kubectl -n kube-system rollout restart deployment coredns
    Important

    DNS resolution errors may occasionally occur during the restart process. For more information, see Reduce the adverse effect of occasional DNS resolution timeouts caused by IPVS defects.

  5. After CoreDNS is updated or restarted, use kubectl to run the following command to query the status of the CoreDNS pod:

    kubectl -n kube-system get pod -l k8s-app=kube-dns

    If the CoreDNS pod is recreated and in the Running state, you can ignore the check item related to using deprecated APIs on the precheck page and continue to update the cluster.