Help & Documentation>Tencent Kubernetes Engine

Service Cross-region Binding

Last updated: 2023-09-26 14:24:31

Feature Overview

When you use the Service of public network CLB type, the CLB is generated for random availability zone in the VPC where the cluster resides by default. Currently, TKE Service of public network CLB allows you to specify availability zones, including availability zones in other regions. This document describes how to bind and specify availability zones for CLB Service across regions via the console and YAML.

Scenarios

The cross-region access or cross-VPC access of CLB must be supported. That is, the VPC where the CLB resides and the VPC where the cluster resides are not in the same VPC.
The availability zone of CLB must be specified to realize unified management of resources.
Note
1. Cross-region binding is only available for bill-by-IP accounts. To check your account type, see Checking Account Type.
2. If you need to use the CLB that is not in the same VPC as this cluster, you need to connect the VPCs of the current cluster and the CLB via CCN.
2.1 The IP address ranges of VPCs in different regions must be planned in advance for CCN, and conflicts should be avoided. Otherwise, conflicting routing rules will not take effect, resulting in the inability to forward data.
2.2 The VPC where the cluster resides cannot join multiple CCNs simultaneously, as this may result in non-unique routes and prevent data plane forwarding.
3. After ensuring that the VPCs are connected, please contact us online to apply for this feature.
4. You should enter the region ID in the following YAML. You can check the region ID in Regions and Availability Zones.

Instructions

You can bind and specify availability zones for CLB Service across regions via the console and YAML.
Using the Console
YAML Method
1. Log in to the TKE console and select Cluster in the left sidebar.
2. On the Cluster Management page, click the ID of the cluster for which you need to create a Service to go to the cluster management page.
3. Select Services and Routes > Service to access the Service page, and click Create.
4. Configure the relevant availability zone rules in the Create Service page. The configuration rules are as follows:
Service Access Method: Select "Public Network CLB Access".


Availability Zone: Select "Other VPC".
Note:
Only supports other VPCs connected to the current cluster's VPC through Cloud Connect Network (CCN).
5. Other parameters can be set according to the configuration during Service creation.
Note
1. If you need to use the CLB that is not in the same VPC as this cluster, you need to connect the VPCs of the current cluster and the CLB via CCN.
2. After ensuring that the VPCs are connected, please contact us online to apply for this feature.

Example 1

If you only need to specify the availability zone of the VPC where the cluster resides, for example, if the VPC of the cluster is located in Guangzhou, and you need to specify the CLB of Guangzhou Zone 1 for CLB Service, you can add the following annotations to the YAML of the Service:
service.kubernetes.io/service.extensiveParameters: '{"ZoneId":"ap-guangzhou-1"}'

Example 2

If you need to use a CLB that is not in the VPC of the cluster, you can add the following annotations to the YAML of the Service:
service.cloud.tencent.com/cross-region-id: "ap-guangzhou"
service.cloud.tencent.com/cross-vpc-id: "vpc-646vhcjj"

Note
If you need to specify the availability zone, you also need to add the annotations of sample 1.

Example 3

Select an existing load balancer for remote access, as shown below:
service.cloud.tencent.com/cross-region-id: "ap-guangzhou"
service.kubernetes.io/tke-existed-lbid: "lb-342wppll"


Example 4

The annotation in the service YAML is as follows:
Creating Cross-Region Access Load Balancer
apiVersion: v1
kind: Service
metadata:
annotations:
service.cloud.tencent.com/cross-region-id: "ap-chongqing"
service.cloud.tencent.com/cross-vpc-id: "vpc-mjekzyps"
name: echo-server-service
namespace: default
spec:
......
---
# Scenarios for users reusing load balancers from other regions
apiVersion: v1
kind: Service
metadata:
annotations:
service.cloud.tencent.com/cross-region-id: "ap-chongqing"
service.kubernetes.io/tke-existed-lbid: "lb-o8ugf2wb"
name: echo-server-service
namespace: default
spec:
......

For detailed Service annotations, please see Service Annotation.