tencent cloud


Using ServiceGroup via YAML File

Last updated: 2022-06-10 16:48:45


    TKE Edge provides the ServiceGroup feature, which only needs two YAML files to implement service deployment in hundreds of regions, without application adaptation or transformation. This document describes how to deploy Nginx services separately within multiple node groups.


    Determining the unique key of ServiceGroup

    This step performs logic planning without involving any actual operations. TKE Edge sets the UniqKey used as the logical flag of the ServiceGroup to be created to zone.

    Grouping edge nodes by label

    Label the edge nodes in the TKE Edge console or by using kubectl in the TKE Edge console as instructed below:

    1. Log in to the TKE console and click Edge Clusters on the left sidebar.
    2. Select the target cluster ID to enter the cluster management page.
    3. Click Node Management > Node to enter the node list page as shown below:
    4. Select More > Edit Label on the right of the target node.
    5. In the Edit Label pop-up window, add a label as instructed below:
      • See the overall architecture chapter. Select zone=nodeunit1 for nodes 12 and 14 and zone=nodeunit2 for nodes 21 and 23.
      • The label key needs to be the same as the UniqKey of the ServiceGroup. The value is a unique key of the NodeUnit. Nodes with the same value belong to the same NodeUnit.
      • If there are multiple ServiceGroups in the same cluster, assign different Uniqkeys to different ServiceGroups.
    6. Click OK.

    Deploying DeploymentGrid

    apiVersion: superedge.io/v1
    kind: DeploymentGrid
      name: deploymentgrid-demo
      namespace: default
      gridUniqKey: zone
            appGrid: nginx
        replicas: 2
              appGrid: nginx
            - name: nginx
              image: nginx:1.7.9
              - containerPort: 80
                protocol: TCP

    Deploying ServiceGrid

    apiVersion: superedge.io/v1
    kind: ServiceGrid
      name: servicegrid-demo
      namespace: default
      gridUniqKey: zone
          appGrid: nginx
        - protocol: TCP
          port: 80
          targetPort: 80

    As shown above, the gridUniqKey field is set to zone. Therefore, you should also set the label key to zone when grouping edge nodes by label. If there are three node groups, add three labels respectively: zone: zone-0, zone: zone-1 , and zone: zone-2 .

    At this point, each node group contains the Deployment and corresponding Pod of Nginx. For access to the same service-name on a node, the requests will be sent to the node in the target group. The verification method is as follows:

    [root@VM_1_34_centos ~]# kubectl get deploy
    NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
    deploymentgrid-demo-zone-0   2/2     2            2           85s
    deploymentgrid-demo-zone-1   2/2     2            2           85s
    deploymentgrid-demo-zone-2   2/2     2            2           85s
    [root@VM_1_34_centos ~]# kubectl get svc
    NAME                   TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
    kubernetes             ClusterIP     <none>        443/TCP   87m
    servicegrid-demo-svc   ClusterIP   <none>        80/TCP    80s

    For node groups added to a cluster after the deployment of DeploymentGrid and ServiceGrid, this feature will automatically create the specified Deployment and Service in the new node groups.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support