☁️ How to connect the CCE (Kubernetes Environment) on Huawei Cloud?

Rabia Yılmaz
Huawei Developers
Published in
5 min readDec 5, 2023
Huawei Cloud CCE Service Connection

Introduction

Welcome to the “How to Connect the CCE (Kubernetes Environment) on Huawei Cloud?” guide. In this article, we will provide you with a comprehensive understanding of the Kubernetes Environment (CCE) on Huawei Cloud, the advantages of using CCE, and a step-by-step guide on how to connect CCE on Huawei Cloud.

Huawei Cloud provides the Container Engine (CCE) that simplifies the deployment, management, and scaling of containerized applications. With CCE, you can build and deploy scalable applications based on Docker and Kubernetes.

Pre Requirements:

If you want to use Lens. It is enough for the connection to Kubernetes env. You can jump to the 3. steps.

  1. Create a CCE On Huawei Cloud.
  2. A Linux machine / VM / WSL machine
  3. Or Lens / Windows / Linux / Mac.

Connection to your CCE environment on Huawei Cloud

  1. We need kubectl on Ubuntu or Linux VM.
  2. When click to configure, we can see how to access the Kubernetes cluster step by step. The example page is below.
  3. After the connection, we can check the connection. You can see the command in the below images

Step 1.1- Login and select Huawei Cloud CCE service. Create a cluster following the article.

Step 1.1

Step 1 .2 — CCE Kubernetes Configure. Then go to the overview page. Select the configure on the right side.

Step 1 .2

Step 2.1 — CCE connection steps on Huawei Cloud. Copy the config.

Step 2.1

Step 2.2 — Copy and paste the connection config file to the path

Step 2.2

Step 2.3 — The kubeconfig looks like that

Step 2.3

Step 3 — Connection Checking

Step 3

What is a KubeConfig file?

The kubeconfig file of Kubernetes is a configuration file used to access Kubernetes clusters. The kubeconfig file contains the credentials, server information, user authentication, and other relevant settings required to connect to a Kubernetes cluster.

The important values in the kubeconfig file are as follows:

‘clusters’: This section contains the name of the Kubernetes cluster and the server information. The server information can include the URL required to access the API server and the path to a specific Certificate Authority (CA) certificate. Multiple ‘clusters’ sections can exist to access different clusters.

‘contexts’: This section represents the interactions of users with the cluster. Each context specifies the association of a user with a cluster and the credentials they will use. It can also define the user’s default ‘namespace’ value.

‘users’: This section contains the credentials. The username and authentication method are defined as an object representing the user’s credentials. Authentication methods can include username/password, JWT token, client certificate, and other user-defined methods.

The kubeconfig file is typically located at $HOME/.kube/config and is used by Kubernetes tools like kubectl.

Example KubeConfig file

apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJ...
server: https://api.cluster-a.example.com
name: cluster-a
- cluster:
certificate-authority-data: LS0tLS1CRUdJ...
server: https://api.cluster-b.example.com
name: cluster-b
contexts:
- context:
cluster: cluster-a
user: user-a
name: context-a
- context:
cluster: cluster-b
user: user-b
name: context-b
current-context: context-a
kind: Config
preferences: {}
users:
- name: user-a
user:
client-certificate-data: LS0tLS1CRUdJ...
client-key-data: LS0tLS1CRUdJ...
- name: user-b
user:
token: eyJhbGciOiJIUzI1Ni...

In this example, there are two different Kubernetes clusters named cluster-a and cluster-b, each with separate user credentials user-a and user-b. The server information and CA certificate for each cluster are specified as well. There are two different contexts named context-a and context-b, where each user is associated with a cluster, and it specifies which context is the default to use.

Of course, a real kubeconfig file will be customized based on a specific Kubernetes cluster and users, and it will contain more details.

Conclusion

In this article, we focused on the process of connecting to a Kubernetes environment running in the cloud. Initially, we covered the stages of designing and deploying a Kubernetes environment, including a reference to setting up a Kubernetes environment in Huawei Cloud. Subsequently, we explored different approaches to remotely connecting to Kubernetes clusters.

At the beginning of the article, we provided fundamental information to develop a general understanding of connecting to a Kubernetes environment. By following these steps, you can easily access and manage remote Kubernetes clusters.

Furthermore, we provided information about other remote connection methods to facilitate your work. By using SSH tunneling, you can securely connect to Kubernetes clusters and protect your data. Additionally, you can employ the same approach to connect to Kubernetes clusters from cloud providers like Huawei Cloud, vSphere, Azure, or AWS.

In conclusion, you have discovered an easy and effective way to connect to a remote Kubernetes environment. With this knowledge, you can monitor, manage, and smoothly operate your Kubernetes clusters. You have now acquired the ability to efficiently manage your cloud-based Kubernetes environments. 😊💻🚀

References

--

--