Skip to main content
This guide shows you how to add public ingress to an app running on a Canonical MicroK8s cluster. You’ll use the ngrok Kubernetes Operator with the Kubernetes Gateway API to route public traffic to the app through an encrypted tunnel.

What you’ll need

  • A MicroK8s cluster reachable with kubectl. MicroK8s runs on a local workstation, an IoT device, a cloud virtual machine, or any system running one of the supported Linux flavors. If you don’t have a cluster yet, follow Canonical’s MicroK8s get-started guide.
  • An ngrok account.
  • kubectl installed on your local workstation.
  • The ngrok Kubernetes Operator installed on your cluster, along with the Gateway API CRDs.
  • A reserved domain from the ngrok dashboard or API; this guide refers to it as NGROK_DOMAIN.
1

Confirm your cluster is ready

Check that MicroK8s is running before you deploy anything:
If you see microk8s is running, your cluster is ready.
2

Deploy an example app

Create a manifest named tinyllama.yaml with the following YAML. It defines a service and deployment for the tinyllama demo LLM app.
tinyllama.yaml showLineNumbers
Apply the manifest to your cluster:
3

Create a GatewayClass

A GatewayClass tells Kubernetes which controller manages your Gateways. This one assigns them to the ngrok Kubernetes Operator.Create a file named gatewayclass.yaml with the following YAML:
gatewayclass.yaml
Apply it to your cluster:
4

Route traffic to the app

The Gateway listens for requests to NGROK_DOMAIN, and the HTTPRoute sends those requests to the tinyllama service.Create a file named tinyllama-gateway.yaml with the following YAML, replacing NGROK_DOMAIN with your reserved domain:
tinyllama-gateway.yaml showLineNumbers
Apply the Gateway and HTTPRoute:
5

Test your app

Open https://NGROK_DOMAIN in a browser. The ngrok Kubernetes Operator routes the request from ngrok’s network to the tinyllama service, so you can reach the app from any device or network.

What’s next?

You’ve used the open source ngrok Kubernetes Operator to add public ingress to an app on MicroK8s with the Kubernetes Gateway API. Because ngrok handles ingress and middleware execution, you can follow the same process for your production apps. To go further, explore the Kubernetes docs for how the Operator works and how to integrate ngrok with an existing production cluster, or try bindings and endpoint pooling.