top of page
GeekGuy

How to deploy Nginx on Kubernetes using Helm Chart

Updated: Jun 22, 2023

Deploying NGINX on Kubernetes using the Bitnami Helm Chart simplifies the deployment of the popular web server on a Kubernetes cluster. The Bitnami NGINX Helm Chart includes a single replica deployment of NGINX and a service to expose it to other Kubernetes resources. By using the Bitnami Helm Chart, you don't need to worry about configuring NGINX from scratch, and you can take advantage of the additional features and security patches provided by Bitnami. After installing the Helm chart, you can create Kubernetes ingress resources to route traffic to your services and take advantage of NGINX's capabilities as a reverse proxy and load balancer. Overall, using the Bitnami Helm Chart can help you deploy NGINX on Kubernetes more quickly and with less configuration. In this tutorial, I'll show you how to deploy the NGINX helm chart on Kubernetes using a CD tool.

Prerequisites

  • Free Harness cloud account (on-premise)

  • A Kubernetes cluster access to deploy our Helm chart. You can use Minikube or Kind for a cluster access.

  • Docker installed. Testing on Docker Desktop.

Tutorial

To deploy the Bitnami NGINX Helm chart, you need a continuous delivery platform, and we are making use of a best-in-class tool, Harness.

Signup to Harness and login to your account.

harness - How to deploy Nginx on Kubernetes using Helm Chart

Next, create a project

harness create project - How to deploy Nginx on Kubernetes using Helm Chart

Add details for the project, name it as per your wish.

harness project detail - How to deploy Nginx on Kubernetes using Helm Chart

Invite collaborators if you want to your CD project.

harness invite collaborators - How to deploy Nginx on Kubernetes using Helm Chart

Select the Continuous Delivery module for the project.

harness continuous delivery - How to deploy Nginx on Kubernetes using Helm Chart

Start your CD journey from here

harness start deployments - How to deploy Nginx on Kubernetes using Helm Chart

Select your deployment type and click on other deployment types. [We are focused on Helm deployment]

harness select deployment type - How to deploy Nginx on Kubernetes using Helm Chart

Start creating a pipeline for your project.

harness start creating pipelines - How to deploy Nginx on Kubernetes using Helm Chart

Add details of the pipeline

harness add detail to pipelines - How to deploy Nginx on Kubernetes using Helm Chart

Select 'Deploy' as stage

harness select deployment stage - How to deploy Nginx on Kubernetes using Helm Chart

Select the deployment type as Native Helm

harness select deployment type - How to deploy Nginx on Kubernetes using Helm Chart

Create a service for the project

harness create service for project - How to deploy Nginx on Kubernetes using Helm Chart

Add Service

harness add new service to project - How to deploy Nginx on Kubernetes using Helm Chart

Add manifest details, select Helm Chart

harness specify manifest type - How to deploy Nginx on Kubernetes using Helm Chart

Select HTTP Helm

harness select http helm - How to deploy Nginx on Kubernetes using Helm Chart

Specify the Helm chart store

harness specify helm chart store - How to deploy Nginx on Kubernetes using Helm Chart

Create a new HTTP Helm Repo Connector

harness connector overview - How to deploy Nginx on Kubernetes using Helm Chart

Add the Helm repo connector details

harness helm chart store credentials - How to deploy Nginx on Kubernetes using Helm Chart

Connect the Helm repo with the Harness Delegate.

harness delegates setup - How to deploy Nginx on Kubernetes using Helm Chart

So, what is Harness Delegate?

A Delegate is a service that runs on your infrastructure to execute tasks on behalf of the Harness platform.

Now, you need to install this Harness Delegate on your Kubernetes cluster.

Make sure you have a cluster access from any cloud provider.

Nothing to worry about if you don't have access to any cluster access. We will make use of Minikube.

Install Minikube on your local machine by following this link.

Once the installation is complete, start the Minikube cluster with the following command.

$ minikube start

You should see a successful output as shown below:

harness minikube start - How to deploy Nginx on Kubernetes using Helm Chart

It is time to install our Harness Delegate

harness new delegates - How to deploy Nginx on Kubernetes using Helm Chart

Run the commands as shown in the installation process

harness helm repo update upgrade - How to deploy Nginx on Kubernetes using Helm Chart

Once done, verify if the Delegate has been installed successfully.

harness install your delegate - How to deploy Nginx on Kubernetes using Helm Chart

Let's go back to the steps where we stopped previously (before installing the Harness Delegate).

Now you should see the Delegate we just installed. Select the same and continue.

harness delegates setup - How to deploy Nginx on Kubernetes using Helm Chart

You should see a successful connection between the helm repo and our Delegate.

harness connection test - How to deploy Nginx on Kubernetes using Helm Chart

Next, add the manifest details as shown

harness manifest details - How to deploy Nginx on Kubernetes using Helm Chart

You should see the manifest details we added

harness new service in projects - How to deploy Nginx on Kubernetes using Helm Chart

You should see the service added; click Continue.

harness nginx helm deployment - How to deploy Nginx on Kubernetes using Helm Chart

Add new environment as pre-prod

harness specify environment - How to deploy Nginx on Kubernetes using Helm Chart

Click New Environment.

harness create new environment - How to deploy Nginx on Kubernetes using Helm Chart

Similarly, add a new infrastructure

harness select environment - How to deploy Nginx on Kubernetes using Helm Chart

Select 'Kubernetes' here.

harness select infrastructure type - How to deploy Nginx on Kubernetes using Helm Chart

Under cluster details, select the connector and add the cluster details.

harness kubernetes k8s cluster connection overview - How to deploy Nginx on Kubernetes using Helm Chart

Let's connect our infrastructure with our Delegate.

harness kubernetes cluster connection details - How to deploy Nginx on Kubernetes using Helm Chart

Click Continue.

harness kubernetes cluster connection delegates setup - How to deploy Nginx on Kubernetes using Helm Chart

Make sure the connection is successful

harness kubernetes cluster connection test - How to deploy Nginx on Kubernetes using Helm Chart

You should see the cluster details and connector in the infrastructure

harness kubernetes namespace connector - How to deploy Nginx on Kubernetes using Helm Chart

You should see the infrastructure we just added.

harness specify infrastructure - How to deploy Nginx on Kubernetes using Helm Chart

Click Continue and you will go to the execution step where we should select the deployment type. We will select 'Rolling'.

harness execution strategy - How to deploy Nginx on Kubernetes using Helm Chart

Finally, this is how our Helm chart deployment looks like.

harness execution - How to deploy Nginx on Kubernetes using Helm Chart

Save the pipeline and run it.

harness save pipelines and run it - How to deploy Nginx on Kubernetes using Helm Chart

You should see a successful execution of all the steps.

harness successful deployment - How to deploy Nginx on Kubernetes using Helm Chart

Let's get to the console view for more clarity.

harness console view - How to deploy Nginx on Kubernetes using Helm Chart

Let's verify if the NGINX deployment is done properly using the command

$ kubectl get deployment

You should see the following output

kube get deployment - How to deploy Nginx on Kubernetes using Helm Chart

Let's expose the deployed NGINX to the outside world and see if we can access it.

kube get service - How to deploy Nginx on Kubernetes using Helm Chart

As you can see, the external IP is pending.

We can expose the external IP using the below minikube command:

$ minikube tunnel

You should see the following output:

minikube tunnel - How to deploy Nginx on Kubernetes using Helm Chart

Now, open a new terminal window and run the following command

$ kubectl get service

You should see the external IP now.

kube get service - How to deploy Nginx on Kubernetes using Helm Chart

We can access the NGINX using the externalip:port

nginx welcome page - How to deploy Nginx on Kubernetes using Helm Chart

Congratulations! We successfully deployed an NGINX helm chart on Kubernetes using Harness CD module.

This way, you can easily deploy any of the Helm charts listed here on Kubernetes using the Harness Continuous Delivery module.

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Stationary photo

Be the first to know

Subscribe to our newsletter to receive news and updates.

Thanks for submitting!

Follow us
bottom of page