Install nginx on Kubernetes Using Gcore Managed Kubernetes and Helm

In this tutorial, we’ll explore how to install nginx in a Kubernetes cluster using the Gcore Managed Kubernetes service and a Helm chart. The main advantage of Gcore Managed Kubernetes is that you get a ready-made Kubernetes cluster in just a few minutes. You don’t have to worry about managing the underlying infrastructure and a master node; simply run worker nodes and deploy applications on them.

You also don’t need much experience with Kubernetes administration to install nginx using our managed service. This tutorial is based on GUI (graphical user interface) tools, so no manual manipulations are required in the command line.

What Is nginx?

nginx is an open-source web server used to deliver static and dynamic content over the internet. The solution offers various features such as reverse proxying, load balancing, caching, and SSL/TLS encryption. nginx is often used as a front-end proxy server for web applications to improve performance and distribute traffic across multiple servers.

nginx installation on Kubernetes can be a great way to scale your web applications and achieve high availability. In this tutorial, we’ll use nginx as a sample deployment and won’t go into detailed nginx configuration. However, you can use the tutorial to install any web service on Kubernetes, similar to the nginx installation described here.

What Is Helm?

Helm is a package manager for Kubernetes that allows you to install, update, and manage applications in a Kubernetes cluster. Using a Helm chart is one of the easiest ways to install an application, such as nginx, on Kubernetes. A Helm chart describes the data set required to create an application instance in a Kubernetes cluster. In other words, a Helm chart is a template that you can use repeatedly to install an application, saving time in the build and deployment process.

How to Install nginx in a Gcore Kubernetes Cluster

Step 1. Create a Kubernetes Cluster

First, let’s create a Kubernetes cluster in Gcore Cloud:

  1. Log in to your Gcore Cloud account. If you don’t yet have a GCore Cloud account, sign up.
  2. Go to Cloud and select Projects.
  3. Click Create project; fill in the Name field. Projects are groups of separate Cloud resources, and these groups are isolated from one another. The isolation gives you the ability to set user rights for each project.
  4. In your project, select the “Kubernetes” category. Click Create Cluster:
Screenshot of the Kubernetes section
Figure 1: Create a Kubernetes cluster

Here’s what you’ll see:

Screenshot of the cluster configuration
Figure 2: The cluster configuration section
  1. Set the cluster parameters:
    • Region: Manassas
    • Minimum/Maximum nodes node: 1/1
    • Type: 2 vCPU / 4GB RAM
    • Volume settings: High IOPS 50GB
    • Network settings: select your network and subnetwork
    • SH Key: choose your public SSH key or generate a new one
    • Cluster name: cluster-1 (or whatever you want)
  1. Now that you’ve completed the set up steps, click Create Cluster. The cluster will appear in the “Kubernetes Cluster” section. Wait until the cluster “Creating” status changes to “Provisioned”.
Screenshot of the provisioned cluster
Figure 3: The provisioned cluster

Step 2. Download the Kubeconfig File

Now you need to download the kubeconfig file. It organizes information about clusters, users, namespaces, and authentication mechanisms. You will use this file later to connect to your cluster via OpenLens.

To download the kubeconfig file, select your cluster and click Kubernetes config:

Screenshot of the cluster properties
Figure 4: Download the kubeconfig file

Step 3. Install OpenLens to your Local Machine and Upload Kubeconfig

To install nginx via Helm chart, we’ll use OpenLens, an open-source IDE (integrated development environment) for Kubernetes. It allows you to manage a Kubernetes cluster in a GUI without using the command line.

  1. To download OpenLens to your machine, navigate to the OpenLens page Releases, select the appropriate installer for your operating system, and follow the installation instructions.
  2. Run OpenLens on your machine.
Screenshot of the OpenLens home page
Figure 5: Running OpenLens
  1. Click Catalog → Cluster and add the kubeconfig file you downloaded in Step 2.
Screenshot of the clusters section
Figure 6: Add the kubeconfig file
  1. After that, you connect to your cluster. Here’s what you’ll see:
Screenshot of the cluster properties page
Figure 7: Connect to the Kubernetes cluster

Step 4. Install nginx via a Helm chart

  1. In OpenLens, click Helm → Charts.
Screenshot of the Helm charts section
Figure 8: Helm charts
  1. In the Search bar, type “nginx” and find the nginx chart.
Screenshot of the nginx chart package
Figure 9: The nginx chart package

Click Install.

  1. In this editor window you can opt to change the chart’s parameters. This stage is optional; you can also simply use the default parameters.
Screenshot of the chart parameters
Figure 10: Set up the chart’s parameters

In the right corner of the window, click Install.

  1. You can also enable the load balancer to improve external connectivity and the fault tolerance of your nginx. In the “Network Services” page, go to the “Connection” section:
Screenshot of the connection section
Figure 11: Enable the load balancer

In the “Ports” field, click Forward to activate port forwarding and then click Start.

Screenshot of the port forwarding configuration
Figure 12: Enable the port forwarding
  1. To check if nginx is working, type the cluster’s external IP address in the address bar of your browser, as follows:

http://<external_ip_address>

For example:

http://45.67.211.154

Press Enter. Here’s what you’ll see:

Screenshot of the nginx home page
Figure 13: Check if nginx is working

Congratulations! You have successfully installed nginx via a Helm chart on Kubernetes.

Conclusion

In this tutorial, we explored how to install nginx on Kubernetes using a Helm chart and Gcore Managed Kubernetes. Check out our other articles dedicated to setting up different types of software on Gcore Cloud instances:

Subscribe and discover the newest
updates, news, and features

We value your inbox and are committed to preventing spam