Updated on 2026-03-10 GMT+08:00

Solution Overview

Background

Microservices are increasingly used to deploy applications. When microservices access each other, they need to resolve domain names.

When you have on-premises IDCs with internal domain names configured, and you have deployed containerized applications on both these IDCs and cloud, you need to enable the containers and nodes in CCE clusters to resolve domain names of both the IDC and cloud.

Suppose you have reconstructed one of your applications using microservices. You run the application management backend in a CCE cluster, deploy the content moderation service in an on-premises IDC, and use the image recognition service on Huawei Cloud. The VPC where CCE resides is connected to the IDC through a private line. Figure 1 shows the deployment architecture.

When a user accesses this application, the interaction below is involved between different microservices.

  • The CCE cluster uses the Huawei Cloud DNS server, by default, to access the image recognition service.
  • The CCE cluster uses the internal DNS server of the IDC to access the content moderation service in the IDC.

In this case, the CCE cluster must be able to use both the Huawei Cloud DNS server and the internal DNS server of the IDC. If the DNS server on the CCE node points to that of the IDC, the domain name of Huawei Cloud cannot be resolved. If the IP address of the IDC internal domain name is added to the hosts file, the configuration of the CCE node needs to be updated in real time when the IDC internal service IP address changes. This is difficult and may cause the CCE node to be unavailable.

The content moderation and image recognition services are used only as examples.

Figure 1 Application deployment architecture

This section describes a solution for enabling an on-premises IDC and a CCE cluster to share DNS resolution, allowing both Huawei Cloud domain names and external domain names to be resolved simultaneously.

Solution 1: Using a DNS Endpoint for Cascading Resolution

You can use VPC Endpoint to create a DNS endpoint cascaded with the IDC DNS server, so that nodes and containers in the CCE cluster can use the IDC DNS server for domain name resolution.

  • If a Huawei Cloud domain name needs to be resolved, the request is forwarded to the DNS endpoint, and the Huawei Cloud DNS server resolves the address and returns the result.
  • If an IDC domain name needs to be resolved, the IDC DNS server directly resolves the address and returns the result.
Figure 2 Accessing both the Huawei Cloud and external domain names from a node

For domain name resolution in a container, you can set the DNS policy to ClusterFirst when creating a pod. In this way, the domain name resolution requests of the container are directly sent to CoreDNS.

  • If a cluster-internal domain name needs to be resolved, CoreDNS directly returns the result.
  • If an external domain name needs to be resolved, CoreDNS forwards the request to the IDC DNS server for resolution.
Figure 3 Accessing both the Huawei Cloud and external domain names from a container

Solution 2: Changing the CoreDNS Configurations for Direct Resolution

Set the DNS policy to ClusterFirst when creating a pod so that the domain name resolution requests of containers are directly sent to CoreDNS.

  • If a cluster-internal domain name needs to be resolved, CoreDNS directly returns the result.
  • If an external domain name needs to be resolved, CoreDNS forwards the request to the IDC DNS server for resolution.
  • If a container accesses a Huawei Cloud internal domain name, the domain name is resolved by the Huawei Cloud internal DNS server.
Figure 4 Changing the CoreDNS configuration

Solution Comparison

Solution

Advantage

Disadvantage

Using the DNS endpoint for cascading resolution

External domain names can be resolved simultaneously in containers and nodes in a CCE cluster.

An external DNS server is required to forward the requests for resolving internal domain names of Huawei Cloud, resulting in performance loss.

Changing the CoreDNS configuration for direct resolution

No external DNS server is required to forward the requests for resolving internal domain names of Huawei Cloud. Therefore, there is no performance loss.

  • External domain names cannot be resolved on CCE cluster nodes.
  • The configuration will be lost if CoreDNS is upgraded or rolled back, and you need to reconfigure CoreDNS.