Solution Overview
Issues
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 the 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 following interaction 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 deployed 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 the 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 changes. This is difficult to implement and may cause the CCE node to be unavailable.
The content moderation and image recognition services are used only as examples.
This section provides a solution for CCE clusters to resolve domain names of both on-premises IDCs and Huawei Cloud.
Solution 1: Using the DNS Endpoint for Cascading Resolution
You can use the VPC endpoint service 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 the Huawei Cloud domain name needs to be resolved, the request is forwarded to the DNS endpoint, and the Huawei Cloud DNS server is used to resolve the address and return the result.
- If the IDC domain name needs to be resolved, the IDC DNS server directly resolves the address and returns the result.
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 resolution result.
- If an external domain name needs to be resolved, CoreDNS forwards the request to the IDC DNS server for resolution.
Solution 2: Changing the CoreDNS Configurations
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 resolution 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 internal DNS server of Huawei Cloud.
Solution Comparison
Solution |
Advantage |
Disadvantage |
---|---|---|
Using the DNS endpoint for cascading resolution |
External domain names can be resolved for 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 |
No external DNS server is required to forward the requests for resolving internal domain names of Huawei Cloud. Therefore, there is no performance loss. |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot