Import an Alibaba Cloud Kubernetes (ACK) Cluster

This tutorial demonstrates how to import an Alibaba Cloud Kubernetes (ACK) cluster through the direct connection method. If you want to use the agent connection method, refer to Agent Connection.

Prerequisites

  • You have a Kubernetes cluster with KubeSphere installed, and prepared this cluster as the host cluster. For more information about how to prepare a host cluster, refer to Prepare a host cluster.
  • You have an ACK cluster with KubeSphere installed to be used as the member cluster.

Import an ACK Cluster

Step 1: Prepare the ACK Member Cluster

  1. In order to manage the member cluster from the host cluster, you need to make jwtSecret the same between them. Therefore, get it first by executing the following command on your host cluster.

    kubectl -n kubesphere-system get cm kubesphere-config -o yaml | grep -v "apiVersion" | grep jwtSecret
    

    The output is similar to the following:

    jwtSecret: "QVguGh7qnURywHn2od9IiOX6X8f8wK8g"
    
  2. Log in to the KubeSphere console of the ACK cluster as admin. Click Platform in the upper-left corner and then select Cluster Management.

  3. Go to CRDs, enter ClusterConfiguration in the search bar, and then press Enter on your keyboard. Click ClusterConfiguration to go to its detail page.

  4. Click on the right and then select Edit YAML to edit ks-installer.

  5. In the YAML file of ks-installer, change the value of jwtSecret to the corresponding value shown above and set the value of clusterRole to member. Click Update to save your changes.

    authentication:
      jwtSecret: QVguGh7qnURywHn2od9IiOX6X8f8wK8g
    
    multicluster:
      clusterRole: member
    

    Note

    Make sure you use the value of your own jwtSecret. You need to wait for a while so that the changes can take effect.

Step 2: Get the kubeconfig file

Log in to the web console of Alibaba Cloud. Go to Clusters under Container Service - Kubernetes, click your cluster to go to its detail page, and then select the Connection Information tab. You can see the kubeconfig file under the Public Access tab. Copy the contents of the kubeconfig file.

kubeconfig

Step 3: Import the ACK member cluster

  1. Log in to the KubeSphere console on your host cluster as admin. Click Platform in the upper-left corner and then select Cluster Management. On the Cluster Management page, click Add Cluster.

  2. Enter the basic information based on your needs and click Next.

  3. In Connection Method, select Direct connection. Fill in the kubeconfig file of the ACK member cluster and then click Create.

  4. Wait for cluster initialization to finish.

Receive the latest news, articles and updates from KubeSphere


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.