< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Add Member Clusters via Agent Connection

This section describes how to add a member cluster via agent connection.

If the host cluster cannot access the Kubernetes API service of the member cluster, you can set the member cluster to connect to the tower service exposed by the host cluster to add the member cluster.

Prerequisites

  • You should have the platform-admin role on the host cluster.

  • KubeSphere Multi-Cluster Agent Connection should have been installed and enabled.

  • All nodes of the member cluster must be able to access the external access address of the tower service of the host cluster. Depending on your network environment, you may need to configure firewall and traffic forwarding rules.

Set Proxy Service Address

After installing the "KubeSphere Multi-Cluster Agent Connection" extension on the host cluster, a service named tower will be automatically created in the system project kubesphere-system.

If Cluster Has Available LoadBalancer

If there is an available LoadBalancer plugin in the host cluster, executing the following command on the host cluster node will show that the tower service has the corresponding EXTERNAL-IP address. This address will be automatically obtained and configured by KubeSphere as the proxy service address, which means you can skip the step of setting the proxy service address.

Run the following command to confirm if there is a LoadBalancer plugin.

kubectl -n kubesphere-system get svc

The output may be as follows:

NAME       TYPE            CLUSTER-IP      EXTERNAL-IP     PORT(S)              AGE
tower      LoadBalancer    10.233.63.191   139.198.110.23  8080:30721/TCP       16h
Note

Mainstream public cloud providers generally provide LoadBalancer solutions, and load balancers can automatically allocate external IPs. If your cluster runs in a local environment, especially in a bare-metal environment, you can use OpenELB as the load balancer solution.

If Cluster Does Not Have Available LoadBalancer

If there is no available LoadBalancer in the host cluster, executing the kubectl -n kubesphere-system get svc command may result in the following output.

NAME       TYPE            CLUSTER-IP      EXTERNAL-IP     PORT(S)              AGE
tower      LoadBalancer    10.233.63.191   <pending>       8080:30721/TCP       16h

Since the EXTERNAL-IP is in the pending state, you need to manually set the proxy address by adding the value of proxyPublishAddress to the kubesphere-config ConfigMap.

  1. On the host cluster node, run the following command to open the kubesphere-config ConfigMap.

    kubectl -n kubesphere-system edit cm kubesphere-config
  2. Search for multicluster and add a new line to define the external IP address of the tower service for accessing Tower.

    multicluster:
      clusterRole: host
      proxyPublishAddress: {Public IP Address}:{Port} # Add this line to set the address to access tower
    Note

    You may need to configure port forwarding rules, such as forwarding Public IP:Port to NodeIP:NodePort.

Add Member Cluster

  1. Log in to the KubeSphere web console of the host cluster with a user having the platform-admin role.

  2. Click Cluster Management.

  3. On the Cluster Management page, click Add Cluster.

  4. On the Basic Information tab, set the name, tags, provider, and description for the member cluster, then click Next.

    ParameterDescription

    Name

    The name of the member cluster. The name can only contain lowercase letters, numbers, and hyphens (-), must start and end with a lowercase letter or number, and can be up to 60 characters long.

    Tag

    Tags for the member cluster. Select tags from the dropdown list.

    Provider

    The provider of the member cluster. You can select the provider from the dropdown list or enter it manually.

    Description

    Description of the member cluster. The description can contain any characters and can be up to 256 characters long.

    Under Advanced Settings, set the identifier for the cluster.

  5. On the Connection Settings tab, set the Connection Method to Agent Connection and click Next.

  6. On the Cluster Configuration tab, set the cluster configuration, then click Create.

    After the member cluster is added, it will be displayed in the cluster list on the Cluster Management page.

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.