You can register an external Kubernetes cluster in the console and manage it through the console.

Prerequisites

  • You have activated Container Service, Auto Scaling (ESS), and Resource Access Management (RAM).

    You can log on to the Container Service console, Auto Scaling console, and RAM console to activate these services respectively.

  • After an external Kubernetes cluster is registered, you cannot use the console to perform the following operations on the cluster: add or remove nodes, upgrade the Kubernetes version, or modify Kubernetes component parameters.

Procedure

  1. Create a cluster connect proxy.
    1. Log on to the Container Service console.
    2. In the left-side navigation pane, choose Clusters > Clusters. The Clusters page appears.
    3. In the upper-right corner, click Register Cluster. The Create Cluster Connect Proxy (Preview) page appears.
      Create a cluster connect proxy.
    4. Set the following parameters.
      Parameter Description
      Cluster Name Enter the name of the cluster.
      Note The name must be 1 to 63 characters in length and can contain digits, Chinese characters, letters, and hyphens (-).
      Resource Group Move the pointer over Account's all Resources at the top of the page and select the resource group where the cluster belongs. The name of the selected resource group is displayed here.
      Region Select the region where the cluster is deployed.
      Zone Select the zone where the cluster belongs.
      VPC Set the VPC network of the cluster. Kubernetes clusters only support VPC networks.
      • If the VPC network that you select has a NAT gateway, Container Service will use this NAT gateway.
      • Otherwise, the system automatically creates a NAT gateway. If you do not want the system to create a NAT gateway, clear the Configure SNAT for VPC check box.
        Note If you clear the check box, you need to create a NAT gateway or configure SNAT rules to enable Internet access for your VPC network. Otherwise, the cluster cannot be created.
      Bind EIP Select whether to bind an Elastic IP address with the cluster. If you select this check box, an Elastic IP address is automatically created and bound to the cluster.
      Log Service Select whether to enable Log Service. You can select an existing project or create a new project.

      If you select the Enable Log Service check box, the Log Service plug-in is automatically installed in the cluster. When you create an application, you can set up Log Service through a few simple steps. For more information, see Use Log Service to collect Kubernetes cluster logs.

      Deletion Protection Select whether to enable Deletion Protection. If you select this check box, the cluster cannot be deleted through the console or API operations.
      Labels
      Attach labels to the cluster. Enter the key and value, and click Add.
      Note
      • The key is required whereas the value is optional.
      • The key is case insensitive and can be up to 64 characters in length. It cannot start with any of the following strings: aliyun, http://, and https://.
      • The value is optional, case insensitive, and can be up to 128 characters in length. It cannot start with string http:// or https://.
      • The key must be unique among the labels attached to the same resource. If you specify a duplicate key, the existing label will be overwritten.
      • You can attach up to 20 labels to one resource. To attach more labels, you must remove existing labels first.
      Terms of Service You must select the Terms of Service check box.
    5. Click Create Cluster on the right of the page to start deployment.
      You can find the newly created cluster on the Clusters page.Clusters page
  2. Register the target cluster.
    1. On the Clusters page, find the new cluster and click Manage in the Actions column to go to the Basic Information page. In this example, click cluster test-external-cluster1.
    2. In the ACK Register Agent Config section, click Copy to copy the code and paste it into a file. Then use kubectl command to run the code on the target cluster to perform registration.
      For example, you can create an agent.yaml file and paste the copied code into the agent.yaml file. You can then run the kubectl apply -f agent.yaml command on the target cluster to perform registration.Registration settings
    3. Run the kubectl get all -n kube-system command on the target cluster to query the agent status.
      NAME                                     READY   STATUS    RESTARTS   AGE
      pod/ack-cluster-agent-655b75c987-dwp6b   1/1     Running   0          9s
      
      NAME                                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
      deployment.apps/ack-cluster-agent   1         1         1            1           26m
      
      NAME                                           DESIRED   CURRENT   READY   AGE
      replicaset.apps/ack-cluster-agent-655b75c987   1         1         1       26m
      After the target cluster is registered, go to the Clusters page and verify that the new cluster is in the Running status.

Result

On the Clusters page, find cluster test-external-cluster1 and click Manage in the Actions column to view basic information about the cluster.Basic information
You can Connect to a Kubernetes cluster by using kubectl and run the kubectl get node command to view information about the nodes in cluster test-external-cluster1. You can use kubeconfig to connect to the registered cluster and deploy applications in the cluster.pod
You can also use Helm to release and manage applications in the registered cluster.helm