Learn How to Deploy NGINX on Kubernetes Using Helm Chart

Valentsea
Total
0
Shares

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



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.
Signup to Harness CD

Next, create a project
project creation

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

Invite collaborators if you want to your CD project.
Invite collaborators

Select the Continuous Delivery module for the project.
cd module

Start your CD journey from here
CD journey

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

Start creating a pipeline for your project.
pipeline

Add details of the pipeline
pipeline details

Select ‘Deploy’ as stage
deploy

Select the deployment type as Native Helm
native helm

Create a service for the project
service details

adding service

Add manifest details, select Helm Chart
manifest details

Select HTTP Helm
Helm chart store

Specify the Helm chart store
Helm store details update

Create a new HTTP Helm Repo Connector
HTTP Helm Repo Connector

Add the Helm repo connector details
repo connector details

Connect the Helm repo with the Harness Delegate.
connect with Harness delegate

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
Enter fullscreen mode

Exit fullscreen mode

You should see a successful output as shown below,
minikube started

It is time to install our Harness Delegate
Delegate setup

Run the commands as shown in the installation process
delegate installation process

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

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.
see delegate

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

Next, add the manifest details as shown
add manifest details

You should see the manifest details we added
manifest details added

You should see the service added; click continue.
service added

Add new environment as pre-prod
add environment

preprod environment

Similarly, add a new infrastructure
add a new infrastructure

Select ‘Kubernetes’ here.
adding infra

Under cluster details, select the connector and add the cluster details.
infra details for kube

Let’s connect our infrastructure with our Delegate.
infrastructure with our Delegate

connection of infra

Make sure the connection is successful
success with connection

You should see the cluster details and connector in the infrastructure
cluster details

You should see the infrastructure we just added.
Kube infra added now

Click continue and you will go to the execution step where we should select the deployment type. We will select ‘Rolling’.
select the deployment type

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

Save the pipeline and run it.
Save the pipeline

You should see a successful execution of all the steps.
successful execution

Let’s get to the console view for more clarity.
Harness console view

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

kubectl get deployment
Enter fullscreen mode

Exit fullscreen mode

You should see the following output
nginx deployment status

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

As you can see, the external IP is pending.

We can expose the external IP using the below minikube command

minikube tunnel
Enter fullscreen mode

Exit fullscreen mode

You should see the following output
minikube tunnel

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

kubectl get service
Enter fullscreen mode

Exit fullscreen mode

You should see the external IP now.
service exposure

We can access the NGINX using the externalip:port

nginx service on local

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.

Total
0
Shares
Valentsea

Weekly web development resources #139

A tool to access, crawl, enrich, and clean data from any webpage or API. An interesting article on…

You May Also Like