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
- Log in to a master node in the cluster.
- 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.
- Copy the content of the kubeconfig file.
- 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
- Log in to the UCS console.
- In the navigation pane, choose Fleets. In the card view of Attached clusters, click Register Cluster.
- 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
- 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).
- Log in to the UCS console.
- 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.
- 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
- Run the following command in the cluster to deploy the agent:
kubectl apply -f agent.yaml
- 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
- 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
- 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.
- Create and manage a workload for multiple clusters. For details, see Creating a Workload for Multiple Clusters.
- Centrally manage traffic of multiple clusters. For details, see Managing Traffic of Multiple Clusters.
- Perform intelligent, visualized O&M of multiple clusters. For details, see Enabling Multi-Cluster Monitoring.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot