☁️CodeArts Integration with Custom Kubernetes Clusters

Ertugrul Basar
Huawei Developers
Published in
6 min readApr 5, 2024
CodeArts

🔦Introduction

Hi everyone! In this article, I will show you how to deploy a Kubernetes object in a custom cluster such as Huawei’s Kubernetes platform CCE (Cloud Container Engine) while utilizing Huawei’s DevSecOps platform, CodeArts. Throughout this process, we will purchase a CCE cluster, create a Kubernetes endpoint for a CodeArts project, upload a YAML file to the CodeArts Artifact, and finally, deploy a Kubernetes deployment using CodeArts Deploy. Therefore, it won’t be a demo that includes only one service. This work will not only serve as a guideline but may also assist you in adapting your business to the cloud.

Before we begin the demo, I want to overview CCE and CodeArts briefly.

⚡️ CCE: Huawei Cloud CCE is essentially a cloud-based platform for running containerized applications. It helps you deploy and manage containerized apps efficiently and securely on Huawei’s cloud infrastructure.

⚡️ CodeArts: CodeArts is a one-stop DevSecOps platform that provides out-of-the-box cloud services for requirement delivery, code commit, check, build, verification, deployment, and release throughout the entire software lifecycle. It consists of the following services: Req (Project Management), Repo (Code Hosting), Check (Code Quality), Build (Code Build), Artifact (Build Hosting), Deploy (Build Deployment), Pipeline (Continuous Delivery), TestPlan (Deployment Test).

💻Demo

Step1: Configuring a CCE Cluster

We need a CCE cluster to which we will deploy our deployment. To access this cluster from our project, we also need to bind an EIP to it.

First, on the CCE dashboard, click on ‘Buy Cluster’

CCE Dashboard

Then, we will purchase a cluster with the following specifications 👇

Cluster Specifications

After the installation of the cluster is complete, click on ‘Create Node’ to add two nodes to the cluster.

CCE Dashboard

Next, purchase two nodes with the following specifications 👇

Node Specifications

After the node configuration is completed, the nodes page will resemble the screenshot below 👇

Node Status

Then, to connect the cluster to the internet, we need to bind an EIP to it. Head over to the overview page and click on ‘Bind’

Cluster Overview

Next, a pop-up will appear. If you don’t have an available EIP like me, click on ‘Create EIP’

Bind EIP — 1

You can make the configurations as per the specifications below 👇

EIP Specifications

After that, we can head back and bind the EIP we just created

Bind EIP — 2

Step2: Creating a Kubernetes Service Endpoint

In order to create a K8s service endpoint, we need to have the Kubeconfig file so we can use it while creating the Kubernetes endpoint in our CodeArts project. Click on ‘Configure’, and a pop-up will appear.

Cluster Overview

In the pop-up that appears, select ‘Public network address’. Then, click on ‘Copy’ when you need to use it in the future steps

Cluster Kubeconfig

Next, we will go to our CodeArts project and navigate to ‘Settings > General > Service Endpoints’. After that, click on ‘Create Endpoint’ and select ‘Kubernetes’.

Service Endpoints — 1

A pop-up will appear, where we will enter our cluster’s URL and Kubeconfig data. Then, we will click on ‘Verify and OK’

Service Endpoints — 2

If the verification is successful, you can see that the endpoint is now created and ready to use.

Service Endpoints — 3

Step3: Upload the YAML File

In the steps we are going to take in the future, CodeArts requires us to upload the Kubernetes YAML file to either the CodeArts Artifact or CodeArts Repo. Navigate to ‘Artifact > Release Repos’, and then upload the YAML file you intend to use in this exercise. If you wish to use the same file that I will use in this exercise, you can refer to this link.

YAML Upload

Step4: Configuring and Running a Deploy Task

We have configured a CCE cluster and added it to the project as an endpoint. Now, we can configure a deploy task and deploy it to the CCE. Head over to ‘CI/CD > Deploy’ and click on ‘Create Application’

Deploy Task — 1

On the next page that appears, give the task a name and click on ‘Next’.

Deploy Task — 2

On the next page, you will see the templates CodeArts provides. Select ‘Kubernetes Custom Cluster Deployment’, and this will automatically add the required step.

Deploy Task — 3

After the task is created, we will configure the step as the screenshot below indicates. First, choose the service endpoint created in this exercise. Then, select the apply command as you want to create a deployment. You can use the imperative style while deploying your objects, but here we’ll use a YAML file, so also enable ‘Use manifest file’. After that, choose the file uploaded to the CodeArts Artifact. Once the step is configured, click on ‘Save & Deploy’, and it will start.

Deploy Task — 4

While the task is running, you can observe the logs in real-time. As you can see, our deploy task has finished successfully 👇

Deploy Task — 5

Now, let’s go back to ‘CCE > Cluster > Workloads’, and you can see that the deployment is now running. Our demonstration is finished as we intended.

Cluster Workloads

👉Conclusion

In today’s article, we have successfully deployed a Kubernetes deployment in CodeArts using a custom CCE cluster. Throughout this process, we purchased a cluster in CCE, uploaded a YAML file to the CodeArts Repo, and deployed a Kubernetes deployment using CodeArts Deploy. This approach can be particularly useful for automating processes, especially when you have a CodeArts subscription in a different region than your CCE cluster or when you want to use CodeArts with a different account than your CCE. As demonstrated, this provides flexibility and streamlines your work. This article serves as a basic guideline for addressing your business needs, and you can adapt this practice to your projects accordingly. Until the next article, goodbye!

💁References

--

--