This feature allows you to create a cluster registration proxy and use the proxy to register a Kubernetes cluster that is deployed in a data center or on a third-party cloud. This way, you can manage your clusters in Alibaba Cloud Distributed Cloud Container Platform (ACK One) in a centralized manner. This topic describes how to create a cluster registration proxy and register a Kubernetes cluster that is deployed in a data center.

Prerequisites

Procedure

  1. Create a cluster registration proxy.
    1. Log on to the ACK console.
    2. In the left-side navigation pane of the ACK console, click Clusters.
    3. In the upper-right corner of the Clusters page, click Create Kubernetes Cluster.
    4. On the Register Cluster tab, set the parameters.
      Parameter Description
      Cluster Name
      Enter a name for the cluster.
      Note The name must be 1 to 63 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). The name cannot start with an underscore (_).
      Resource Group
      Move the pointer over All Resources at the top of the page and select the resource group that you want to use. After you select a resource group, virtual private clouds (VPCs) and vSwitches are filtered based on the selected resource group. When you create a cluster, only the VPCs and vSwitches that belong to the selected resource group are displayed in the console. Resource group
      Region

      Select a region to deploy the cluster.

      VPC Select a virtual private cloud (VPC) from the drop-down list.
      vSwitch Select a node vSwitch that belongs to the specified VPC.
      Network Plug-in If you select Disable, node pools are not used to scale computing resources. In this case, network plug-ins are not required.
      If you select Terway and IPVLAN, IPVLAN and Extended Berkeley Packet Filter (eBPF) are used to implement network interface controller (NIC) virtualization and sharing. In this case, you must use the Alibaba Cloud Linux 2 operating system.
      Pod vSwitch Select a pod vSwitch that belongs to the specified VPC.
      Service CIDR Use the default value 172.21.0.0/20 unless you have specific requirements.
      Access to API Server
      By default, an internal-facing SLB instance is created for the Kubernetes API server of the cluster. You can modify the specification of the SLB instance. For more information, see Instance specifications.
      Notice If you delete the SLB instance, you cannot access the Kubernetes API server of the cluster.
      EIP Specify whether to associate an elastic IP address (EIP) with the cluster. If you select this check box, an EIP is automatically created and associated with the cluster.
      Note If the Kubernetes cluster is connected to Alibaba Cloud over the Internet, you must select this option. You do not need to select this option if the Kubernetes cluster is connected to Alibaba Cloud over an Express Connect circuit.
      Security Group
      You can select Create Basic Security Group, Create Advanced Security Group, or Select Existing Security Group. For more information about security groups, see Overview.
      Note
      Log Service Specify whether to enable Log Service. You can select an existing Log Service project or create one.

      If you select Enable Log Service, the Log Service plug-in is automatically installed in the cluster. You can use Log Service with simple configurations when you create an application. For more information, see Collect log data from containers by using Log Service.

      Deletion Protection Specify whether to enable deletion protection for the cluster. Deletion protection prevents the cluster from being deleted in the console or by calling the API. This prevents user errors.
      Labels
      Add labels to cluster nodes. Enter a key and a value, and then click Add.
      Note
      • Key is required. Value is optional.
      • Keys are not case-sensitive. A key must be 1 to 64 characters in length, and cannot start with aliyun, acs:, http://, or https://.
      • Values are not case-sensitive. A value must be 1 to 128 characters in length, and cannot start with aliyun, acs:, http://, or https://. The Value parameter can be left empty.
      • The keys of labels that are added to the same resource must be unique. If you add a label with a used key, the label overwrites the label that uses the same key.
      • If you add more than 20 labels to a resource, all labels become invalid. You must remove excess labels for the remaining labels to take effect.
      Terms of Service Read and select Terms of Service and Disclaimer.
    5. On the right side of the page, click Create Cluster.
      You can find the newly created cluster on the Clusters page. Cluster list
  2. Register a Kubernetes cluster.
    1. On the Clusters page, select the newly created cluster and click Details in the Actions column. In this example, select the cluster test-external-cluster1.
    2. On the details page of the cluster, click the Connection Information tab.
    3. In the Agent for Connecting to the Cluster section, click the Public Network or Internal Network tab based on your business requirements and then click Copy on the right side. Create a YAML file and paste the copied code to the file. Then, use kubectl to execute the file and register the external cluster.
      For example, you can create a file named agent.yaml and paste the copied code to the agent.yaml file. Then, run the kubectl apply -f agent.yaml command in the Kubernetes cluster to register the cluster.
      Notice

      If the Kubernetes cluster is connected to Alibaba Cloud over the Internet, select Public Network. If the Kubernetes cluster is connected to Alibaba Cloud over an internal network, select Internal Network.

      Import configurations
    4. Run the following command in the Kubernetes cluster to query the status of the agent:
      kubectl -n kube-system get pod |grep ack-cluster-agent

      The following figure shows the expected output.

      ack-cluster-agent-5f7d568f6-6fc4k              1/1     Running   0          9s
      ack-cluster-agent-5f7d568f6-tf6fp              1/1     Running   0          9s
      After the cluster is registered, verify that the cluster is in the Running state on the Clusters page.

Result

On the Clusters page, find the newly registered cluster and click Details in the Actions column. On the page that appears, you can view Basic Information and Connection Information about the cluster.

You can use kubeconfig to connect to the cluster and deploy applications in the cluster. For more information, see Use kubectl to connect to an ACK cluster.