Help Center/ Ubiquitous Cloud Native Service/ User Guide/ UCS Clusters/ Attached Clusters/ Registering an Attached Cluster (Public Network Access)
Updated on 2024-11-12 GMT+08:00

Registering an Attached Cluster (Public Network Access)

This section describes how to register an attached cluster and connect it to UCS over a public network.

Constraints

  • A Huawei Cloud account must have the UCS FullAccess and VPCEndpoint Administrator permissions.
  • If you are connecting a cluster outside the Chinese mainland to UCS, the connection and the subsequent actions you will take must comply with local laws and regulations.
  • Registered Kubernetes clusters must pass the CNCF Certified Kubernetes Conformance Program and be between v1.19 and 1.29.

Prerequisites

  • A cluster has been created and is running properly.
  • The node where the proxy-agent component is deployed must be accessible from the public network through an EIP or a NAT gateway.
  • You have obtained the kubeconfig file of the cluster. For guides of obtaining the kubeconfig file, see kubeconfig. For details about the kubeconfig file, see Organizing Cluster Access Using kubeconfig Files.

Registering a Cluster

  1. Log in to the UCS console.
  2. In the navigation pane, choose Fleets. In the card view of Attached cluster, click Register Cluster.
  3. Configure the cluster parameters listed in Table 1. The parameters marked with an asterisk (*) are mandatory.

    Table 1 Basic information for registering a cluster

    Parameter

    Description

    * Cluster Name

    Enter a name, starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

    * Service Provider

    Select a cluster service provider.

    * Region

    Select a region where the cluster is deployed.

    Cluster Label

    Optional. You can add labels in the form of key-value pairs to classify clusters. A key or value can contain a maximum of 63 characters starting and ending with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

    * kubeconfig

    Upload the kubectl configuration file to complete cluster authentication. The file can be in JSON or YAML format. The procedure for obtaining the kubeconfig file varies according to vendors. For details, see kubeconfig.

    * Context

    Select the corresponding context. After the kubeconfig file is uploaded, the option list automatically obtains the contexts field from the file.

    The default value is the context specified by the current-context field in the kubeconfig file. If the file does not contain this field, you need to manually select a context from the list.

    Fleets

    Select the fleet that the cluster belongs to.

    A cluster can be added to only one fleet. Fleets are used for fine-grained access management. If you do not select a fleet, the cluster will be displayed on the Clusters Not in Fleet tab upon registration. You can add it to a fleet later.

    When registering a cluster, you cannot select a fleet with cluster federation enabled. To add your cluster to the fleet with cluster federation enabled, register your cluster with UCS first. For details about cluster federation, see Enabling Cluster Federation.

    For details about how to create a fleet, see Managing Fleets.

  4. Click OK. After the registration is complete, Figure 1 is displayed. Connect the cluster to the network within 30 minutes. You can choose either the public or the private network access mode. For details about the network connection process, click in the upper right corner.

    If the cluster is not connected to UCS within 30 minutes, it will fail to be registered. In this case, click in the upper right corner to register it again. If the cluster has been connected to UCS but no data is displayed, wait for 2 minutes and refresh the cluster.

    Figure 1 Cluster waiting for network connection

Connecting the Cluster to UCS

After the cluster is registered with UCS, its status is Pending connection. In this case, the network connection between UCS and the cluster is not established. You need to configure a network agent in the cluster.

  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

    Expected output for successful deployment:

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

  6. Check the running status of the cluster agent.

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

    Expected log output for normal running:

    Start serving

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