Updated on 2024-06-11 GMT+08:00

Networking

Overview

This section describes how you can:

  • Specify a default DNS server for the pods scheduled to CCI.
  • Use a Service to enable communications between the pods in a CCE cluster and the pods in CCI.
  • Use a Service to expose pods in CCI.

Constraints

If the bursting add-on is installed in CCE clusters for interconnecting with CCI 2.0, Ingresses that use dedicated load balancers can be created, but Services of the LoadBalancer are not supported.

Specifying a Default DNS Server

Scenario

In some scenarios, you need to specify a default DNS server for the pods scheduled to CCI. The bursting add-on allows you to specify a DNS server address without the need to configure the dnsConfig field for each pod, reducing network O&M costs.

Procedure

  1. Log in to a CCE cluster node and edit the YAML file.
    kubectl edit deploy cceaddon-virtual-kubelet-virtual-kubelet -nkube-system
  1. Add --cluster-dns=x.x.x.x to the startup parameters and replace x.x.x.x with the DNS server address.
  2. Save the modification and wait for the virtual-kubelet workload to restart.

  3. Verify the DNS server address.
    Run the exec command to access a container running in CCI and check whether the IP address following nameserver in the first line is the address configured for cluster-dns in the /etc/resolv.conf file.
    Table 1 Constraints in different application scenarios

    Scenario

    Constraints

    There are pods running in CCI before the DNS server address is specified.

    • The DNS server address is only available for new pods that are scheduled to CCI.
    • To make the DNS server address available for the pods that are running before the modification, these pods need to be redeployed.

    There is a limit for cluster-dns

    • You can specify a maximum of three IP addresses for nameservers in dnsConfig.
    • Ensure that the sum of the nameserver value in cluster-dns and the nameservers value in Pod dnsConfig does not exceed 3.

How to Use a Service to Enable Communications Between Pods in a CCE Cluster and Pods in CCI

  1. Install the bursting add-on and enable Networking.

    After the installation is successful, a load balancer is automatically created in your account. You can view the load balancer on the networking console.

  2. Create a pod in CCI and configure a Service to expose the pod.
    • To facilitate verification, select the Nginx image that uses port 80.
    • Automatically creating a load balancer is recommended to avoid conflicts with the load balancer created by the bursting-add.

  3. Obtain the access mode of the pod on the CCE cluster console.
  4. Create a pod in CCE and configure a Service to expose the pod. For details, see 2.

    Do not select the label for pods scheduled to CCI.

  5. Verify network connectivity.

    Create a pod in CCI and select an image that contains the curl command, for example, centos.

    Access the container on the CCI console and check whether CCI can access CCE through the Service.

    Figure 1 Service for accessing the pod in CCI
    Figure 2 Service for accessing the pod in CCE
  6. Create a pod in CCE and select an image (for example, CentOS) that allows for the curl command. Then check whether CCE can access CCI through the Service.