Updated on 2025-11-19 GMT+08:00

Step 3: Add Clusters to the Fleet

You need to register clusters and connect them to UCS, so that they can be added to the fleet.

UCS supports Huawei Cloud clusters, on-premises clusters, attached clusters, multi-cloud clusters, and partner cloud clusters. The following uses an attached cluster as an example.

Obtaining kubeconfig

  1. Log in to a master node in the cluster.
  2. Obtain the kubeconfig file of the cluster.

    cat $HOME/.kube/config

    By default, the kubeconfig file of a self-managed cluster is stored in the $HOME/.kube/config directory on the master nodes. If another kubeconfig file is specified for your cluster, change the directory. For details about the kubeconfig file, see Organizing Cluster Access Using kubeconfig Files.

  3. Copy the content of the kubeconfig file.
  4. Create a YAML file on the local PC, paste the content copied in the previous step to the YAML file, and save it.

Registering a Cluster

  1. Log in to the UCS console.
  2. In the navigation pane, choose Fleets. In the card view of Attached clusters, click Register Cluster.
  3. Configure the parameters. In this example, only key parameters listed in Table 1 are configured.

    Table 1 Parameters for registering a cluster

    Parameter

    Mandatory

    Description

    Cluster Name

    Yes

    Enter a name. The name must start with a lowercase letter but not end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

    Service Provider

    Yes

    Select the service provider of the cluster.

    Region

    Yes

    Select the region where the cluster is located.

    kubeconfig

    Yes

    Upload the kubeconfig file saved in Obtaining kubeconfig to complete cluster authentication. The file must be in JSON or YAML format.

    Context

    Yes

    Select the corresponding context.

    The option list is available after the kubeconfig file is uploaded. By default, the option list is the context specified by the current-context field in the kubeconfig file.

    Fleet

    No

    Select the fleet created in Step 2: Create a Fleet.

    Figure 1 Registering a cluster

  4. Click OK.

Configuring Cluster Access

You need to configure a proxy for the registered cluster to access the network so that the cluster can be taken over by UCS. There are public network access and private network access.

Public network access features flexibility, cost-effectiveness, and easy operations. The following uses public network access as an example. If you require high speed, low latency, stability, and security, you can select private network access. For details, see Registering an Attached Cluster (Private Network Access).

  1. Log in to the UCS console.
  2. Click Public access in the row of the target cluster to download the configuration file of the cluster agent.

    The configuration file contains private keys and can be downloaded only once. Keep the file secure.

  3. Use kubectl to connect to the cluster, run the following command to create a YAML file named agent.yaml (which can be changed as needed) in the cluster, and copy the agent configuration in 2 and paste it to the YAML file:

    vim agent.yaml

  4. Run the following command in the cluster to deploy the agent:

    kubectl apply -f agent.yaml

  5. Check the deployment of the cluster agent.

    kubectl -n kube-system get pod | grep proxy-agent

    If the deployment is successful, the expected output is:

    proxy-agent-5f7d568f6-6fc4k 1/1 Running 0 9s

  6. Check the status of the cluster agent.

    kubectl -n kube-system logs <Agent Pod Name> | grep "Start serving"

    If the cluster agent is running normally, the expected log output is:

    Start serving

  7. Go to the UCS console and refresh the cluster status. The cluster is in the Running state.

Follow-up Operations

Add the cluster to the fleet. You can also add clusters of other types to the fleet. For details, see UCS Clusters.

UCS allows for centralized management of clusters within a fleet, such as enabling cluster federation, deploying and managing a workload, and managing traffic for clusters within the fleet.

The following are common UCS functions. Select a guide based on your service requirements to quickly get started with multi-cluster management.