December 1, 2022

Deploying a To-Do Application to Kubernetes with Harness

Table of Contents

Key takeaway

Continuous integration and delivery (CI/CD) is a very important part of any successful DevOps methodology. DevOps ensures the use of microservices, containerizing the applications, using CI/CD, deploying applications using cloud-native technologies such as Kubernetes, and more. All these things speed up and streamline the process of software development and help developers collaborate. Harness is a modern software delivery platform helping thousands of developers adopt CI/CD. 

We would love to show how easy it is to set up CI/CD with Harness and streamline your software delivery process. Taking an example of a to-do application that is simple and easily understood by developers, I’ll show you how to deploy it to Kubernetes using Harness. To-do application is something that every developer is familiar with and involves simple operations of creating tasks. Follow the tutorial to learn how we can easily deploy this application using Harness CI/CD. 


  • Download and install Node.js 
  • Harness platform free account access
  • Kubernetes cluster access from any cloud provider. You can also use Minikube or Kind to create a single node cluster. 


Use the command git clone to clone the repo to your local machine.

Then, get into the main folder with the command:

cd todo-list-app

Then use the command npm install to install all the dependencies needed for the project.

Run the application with the command node app.js and visit http://localhost:8080 in your browser to see the application working. To run the test, you can simply use the command npm test. We have both deployment.yaml and service.yaml files set to deploy and expose the application through Kubernetes. 

Below is the deployment.yaml file:

apiVersion: apps/v1
kind: Deployment
   app: todo-app
 name: todo-app
 replicas: 2
     app: todo-app
       app: todo-app
     - image: dockerhub image name
       name: todo-app
       - containerPort: 8080

Below is the service.yaml file:

apiVersion: v1
# Indicates this as a service
kind: Service
 # Service name
 name: todo-app
   # Selector for Pods
   app: todo-app
   # Port Map
 - port: 80
   targetPort: 8080
   protocol: TCP
 type: LoadBalancer

CI/CD: Using Harness 

Harness has a pretty sleek UI and can easily help developers do CI/CD effortlessly. Once you sign-up at Harness, make sure you have access to the Kubernetes cluster to deploy your application. Login to the Harness platform and ensure the basic connectors are ready. Also, make sure you have the Delegate installed on your target Kubernetes cluster. 

The Harness Delegate is a service/software you need to install/run on the target cluster (Kubernetes in our case) to connect your artifacts, infrastructure, collaboration, verification and other providers with the Harness Manager. When you set up Harness for the first time, you install a Harness Delegate.

If you want to know more about Delegate, you can read here.

Create a project on Harness to set up CI/CD. First, select the continuous integration module and then the delivery module.

Enter the deployment stage

As you can see above, we will first test and build, and then we will deploy the application to the Kubernetes cluster.

Test and Build set-up is shown below:

Basically, we are configuring the infrastructure (Kubernetes, in our case), specifying to carry out the tests, and finally pushing the build image to Docker Hub after the successful test cases. 

When you click on the test step, you will see our configuration:

Similarly, the delivery module details and configuration will look like:

After all the configuration, you can save and run the pipeline to see the successful execution of the pipeline steps. First, you will see Test and Build stage completing and then you see the deployment stage.

The deployment stage execution is shown below:

Learn More

Now you can test, build and deploy your application on Kubernetes using the Harness platform. If you're interested learning more about using Harness and intelligent software delivery, check out our Developer Hub for more step-by-step tutorials, videos, and reference docs.

You might also like
No items found.

Similar Blogs

No items found.
Continuous Delivery & GitOps