Connecting a Third-Party Kubernetes Cluster
UCS automatically takes over your CCE cluster.
This section uses a self-built cluster as an example to describe how to quickly connect a Kubernetes cluster to UCS through a public network.
- Log in to the master node in the cluster to be connected.
- Obtain the cluster kubeconfig file.
By default, the kubeconfig file of a self-built cluster is stored in the $HOME/.kube/config directory of the master node. 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 credential content.
- Create a YAML file on the local PC, paste the credential content copied in the previous step to the file, and save the file.
Connecting a Cluster
- Log in to the UCS console. In the navigation pane, choose Container Clusters.
- Click Connect under the cluster type.
- Select a cluster service provider and set cluster parameters as prompted. In this example, only key parameters listed in Table 1 are set.
Table 1 Parameters for connecting a cluster
* Service Provider
Select a cluster service provider.
Upload the kubectl configuration file to complete cluster authentication. The file can be in JSON or YAML format.
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. If the file does not contain this field, you need to manually select an option from the list.
* Cluster Name
Enter a name for the cluster. Start with a lowercase letter and do not end with a hyphen (-). Use only digits, lowercase letters, and hyphens (-).
Select a region where the cluster is deployed.
* Cluster Group
Select the cluster group to which the cluster belongs. Defaults to default.Figure 1 Registering a cluster
- Click OK.
Enabling Network Access
After a cluster is connected, you need to configure a proxy for the cluster to access the network so that the cluster can be taken over by UCS. The following section uses public network access as an example.
Connecting a cluster through a public network is easy, flexible, and cost-effective. If you require high speed, stability, and security while low latency, you can access the cloud through a private network. For details, see Connecting a Non-CCE Cluster (Private Access).
- Go to the UCS console and click Public Network Access in the row of the cluster to be accessed to view the detailed public network access process.
- Download the configuration file of the cluster agent.
The agent configuration file contains keys and can be downloaded only once. Keep the file secure.
- Use kubectl to connect to the cluster, create a YAML file named agent.yaml (the file name can be customized) in the cluster, and paste the agent configuration content in 2 to the YAML file.
- Run the following command in the cluster to be connected 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 as follows:
proxy-agent-5f7d568f6-6fc4k 1/1 Running 0 9s
- Check the running status of the cluster agent:
kubectl -n kube-system logs <Agent Pod Name> | grep "Start serving"
If the is running properly, the expected log output is as follows:
- Go to the UCS console and refresh the cluster status. The cluster is in the Running state.
Figure 2 Cluster in running state
Was this page helpful?Provide feedback
For any further questions, feel free to contact us through the chatbot.Chatbot