Skip to main content
In this guide, we’ll walk through the process of deploying a simple HTTP server secured with TLS and exposed via the Kubernetes Gateway API. To securely deploy your applications on Ubicloud Kubernetes clusters using TLS, set up NGINX Gateway Fabric along with cert-manager. This setup handles all your TLS needs using the Gateway API. Follow this step-by-step guide to deploy and expose an HTTPS application on your Kubernetes cluster.

Prerequisites

To complete this tutorial, kubectl and helm must be installed. You can follow the official installation guides available on the Kubernetes website and Helm website You’ll also need an active domain and access to the control panel for managing DNS records in order to complete this guide.

Creating a Kubernetes Cluster

If you don’t have a Kubernetes cluster yet, you can create one using Ubicloud. Follow the instructions in the Quickstart Guide to set up your cluster and configure kubectl to access it.

Installing the required addons

You’ll need an email to register yourself with letsencrypt.
Next, we’ll install the Gateway API CRDs, NGINX Gateway Fabric, and cert-manager.
We’ll also create a ClusterIssuer in order to get certificates from letsencrypt for our service. Note the gatewayHTTPRoute solver, which tells cert-manager to use the Gateway API for HTTP-01 challenges.

Create a Gateway

First, create a CNAME record with your DNS provider pointing *.somesubdomain.yourdomain.com to the domain listed in the “Service URL” in the Overview page of your Kubernetes cluster in Ubicloud console. Feel free to use any subdomain that best suits your setup.
Next, create a Gateway resource. NGINX Gateway Fabric will automatically provision a LoadBalancer Service and an NGINX data plane when a Gateway is created.
Once the Gateway is created, a Service named gateway-nginx will appear in the default namespace. This Service is of type LoadBalancer, and the EXTERNAL-IP column will display a domain that resolves to the IPs of your worker nodes. You can see this service using the command below
Here’s a sample output of the command:

Deploy the application, Service, and HTTPRoute

Now deploy a simple NGINX web server, expose it as a Service, and create an HTTPRoute to route external HTTPS traffic to it.
This creates three resources:
  • Deployment: Runs an NGINX container that serves the default welcome page on port 80.
  • Service: Exposes the Deployment inside the cluster so that the HTTPRoute can forward traffic to it.
  • HTTPRoute: Attaches to the Gateway’s https listener (via sectionName: https) and routes all requests for hello-world.<your-domain> to the hello-world-service. This is the resource that connects your external HTTPS traffic all the way to your application pods.
Now you can visit https://hello-world.somesubdomain.yourdomain.com!