Import an Alibaba Cloud Kubernetes (ACK) Cluster
- 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
In order to manage the Member Cluster from the Host Cluster, you need to make
jwtSecretthe 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:
Log in to the KubeSphere console of the ACK cluster as
admin. Click Platform in the upper-left corner and then select Cluster Management.
Go to CRDs, enter
ClusterConfigurationin the search bar, and then press Enter on your keyboard. Click ClusterConfiguration to go to its detail page.
Click on the right and then select Edit YAML to edit
In the YAML file of
ks-installer, change the value of
jwtSecretto the corresponding value shown above and set the value of
member. Click Update to save your changes.
authentication: jwtSecret: QVguGh7qnURywHn2od9IiOX6X8f8wK8g
multicluster: clusterRole: member
NoteMake 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.
Step 3: Import the ACK Member Cluster
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.
Enter the basic information based on your needs and click Next.
In Connection Method, select Direct Connection. Fill in the kubeconfig file of the ACK Member Cluster and then click Create.
Wait for cluster initialization to finish.