Help Center/ Cloud Container Engine/ FAQs/ DNS FAQs/ How Can I Address the Issue of CoreDNS Using Deprecated APIs?
Updated on 2025-04-02 GMT+08:00

How Can I Address the Issue of CoreDNS Using Deprecated APIs?

Symptom

In a v1.19 CCE cluster where CoreDNS is installed, there may be an issue where CoreDNS continues to listen to v1beta1 of EndpointSlice resources even after upgrading the cluster to v1.25 or v1.27. In v1.25 CCE clusters, v1beta1 of EndpointSlice resources are no longer supported. This results in CoreDNS not being able to receive the latest Service or endpoint change events, leading to the following impacts:

  • Failure in resolving new Service domain names: The new domain names cannot be resolved during the use of Services.
  • Exception in parsing headless Services: After workload changes and pod recreation, CoreDNS cannot resolve the IP address of the new pod and instead returns the IP address of the old one from the cache, affecting service access.

Cause Analysis

In v1.19 CCE clusters, CoreDNS is using the community version 1.8.4. When CoreDNS starts with this version, it first looks for v1 EndpointSlice resources. If such resources are not found, it falls back to using v1beta1 EndpointSlice resources. Kubernetes 1.19 only supports v1beta1 EndpointSlice resources, so CoreDNS relies on these resources to get Service and endpoint change events. However, Kubernetes 1.25 removes support for the v1beta1 EndpointSlice API. Therefore, after upgrading the cluster to v1.25, CoreDNS still tries to listen to the now-removed v1beta1 EndpointSlice resources, leading to a failure in obtaining Service and endpoint events.

You can check the CoreDNS logs. For details, see Viewing Container Logs. If the logs contain the following information, it means that CoreDNS is listening to deprecated APIs:

[ERROR] plugin/kubernetes: k8s.io/client-go@v0.26.1/tools/cache/reflector.go:169: Failed to watch *v1beta1.EndpointSlice: failed to list *v1beta1.EndpointSlice: the server could not find the requested resource 
[INFO] plugin/kubernetes: k8s.io/client-go@v0.26.1/tools/cache/reflector.go:169: failed to list *v1beta1.EndpointSlice: the server could not find the requested resource

Solution

Restart the CoreDNS pod to enable CoreDNS to listen to v1 EndpointSlice resources.

The restart may cause temporary fluctuation of the domain name resolution in the cluster. You are advised to perform this operation during off-peak hours.

You can perform the following operations to recreate the CoreDNS pod:

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose Workloads and select the kube-system namespace.
  2. Locate the row containing the coredns workload and choose More > Redeploy.

  3. Wait for the coredns workload to run again.