Updated on 2024-02-01 GMT+08:00

Managing Fleets

Constraints

  • Only Huawei Cloud account or users with the UCS FullAccess permission can create and delete fleets.
  • A cluster can join only one fleet.

Creating a Fleet

  1. Log in to the UCS console. In the navigation pane, choose Fleets. On the Fleets tab, click Create Fleet.
  2. Enter the fleet information.

    Figure 1 Creating a fleet
    • Fleet Name: Enter a name, starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.
    • Add Cluster: Clusters not in the fleet are displayed in the list. You can add clusters when creating a fleet or after the fleet is created. If you do not select any cluster, an empty fleet will be created. After the fleet is created, see Adding a Cluster.
    • Description: description of the fleet to which the cluster is added

    A registered cluster will follow the fleet permissions policies, not its own ones.

  3. Click OK.

Adding a Cluster

  1. Log in to the UCS console. In the navigation pane, choose Fleets.
  2. In the card view of the destination fleet, click Add Cluster, or click in the upper right corner.

    You can also click the fleet name to go to the fleet details page and click Add Cluster in the upper right corner of the Container Clusters page.

    Figure 2 Adding a cluster to a fleet

  3. Select one or more existing clusters. A cluster can only be added to one fleet. The clusters displayed in the list are those have not been added to any fleet.

    Figure 3 Adding a cluster
    • A registered cluster will follow the fleet permissions policies, not its own ones.
    • In a federation-enabled fleet, registered clusters automatically become federated. For details about cluster federation, see Enabling Cluster Federation.

  4. Click OK.

Associating a Permission Policy

  1. Log in to the UCS console. In the navigation pane, choose Fleets.
  2. In the card view of the destination fleet, click in the upper right corner.

    Figure 4 Associating a permission policy with a fleet

  3. On the displayed page, click Update Fleet Permissions. On the displayed page, associate the created permission policy with the namespace of the fleet.

    Figure 5 Updating a permission policy
    • Namespace: Select All namespaces or Namespace. All namespaces includes the existing namespace of the fleet and the namespace to be added to the fleet. Namespace indicates the custom range of namespaces. UCS provides several common namespaces, such as default, kube-system, and kube-public. You can also add a namespace, which should exist in the cluster.

      If you select namespaces, permission policies take effect only on namespace resources, not cluster resources. For details about namespace and cluster resources, see Kubernetes Resource Objects.

    • Set Permissions: Select permissions from the drop-down list box. You can select multiple permissions at a time to batch grant permissions.

    If different namespaces are associated with different permission policies (for example, the default namespace is associated with the readonly permission policy and the development namespace is associated with the develop permission policy), you can click to add multiple relationships of permission granting.

  4. Click OK.

    If you need to update the permission policy of the fleet, select the namespace and permission again using the preceding method.

Removing a Cluster from a Fleet

  1. Log in to the UCS console. In the navigation pane, choose Fleets.
  2. On the Fleets tab page, click a fleet name. The fleet details page is displayed.
  3. In the navigation pane, choose Container Clusters. In the card view of the destination cluster, click in the upper right corner.
  4. Read the precautions carefully and confirm the risks. Then click OK.

    After a cluster is removed from a fleet, it is displayed on the Clusters Not in Fleet tab page. You can add the cluster to the fleet again. For details, see Managing Clusters Not in the Fleet.

    Figure 6 Removing a cluster from a fleet

Unregistering a Cluster from a Fleet

  1. Log in to the UCS console. In the navigation pane, choose Fleets.
  2. On the Fleets tab page, click a fleet name. The fleet details page is displayed.
  3. In the navigation pane, choose Container Clusters. In the card view of the destination cluster, click in the upper right corner.
  4. In the displayed Unregister Cluster dialog box, read the precautions carefully, confirm the risks, and click OK.

    Figure 7 Unregistering a cluster

  5. (Optional) After an attached cluster is unregistered, run the following command to uninstall the agent component from the destination cluster:

    kubectl -n kube-system delete deployments/proxy-agent secret/proxy-agent-cert

  6. (Optional) After an on-premises cluster is unregistered, run the uninstallation command to delete the cluster from the local host and clear resources:

    ./ucs-ctl delete cluster [Cluster name]

    If the cluster fails to be deleted, perform operations in How Do I Manually Clear Nodes of an On-premises Cluster?.

Deleting a Fleet

If a fleet is no longer used, you can delete it. There are two restrictions on deletion: there is no cluster in the fleet and cluster federation has been disabled for the fleet. If there are clusters in the fleet, you can remove the clusters from the fleet and then add them to another fleet. If cluster federation has been enabled for the fleet, disable it following Disabling Cluster Federation.

  1. Log in to the UCS console. In the navigation pane, choose Fleets.
  2. On the Fleets tab page, locate the destination fleet and click in the upper right corner.

    Figure 8 Deleting a fleet

  3. In the displayed dialog box, click OK.