Skip to main content

ngrok

The ngrok Ingress Controller for Kubernetes adds public and secure ingress traffic to Kubernetes applications. Enforce authentication and authorization at the edge with ngrok, preventing unauthorized traffic from ever reaching your cluster and rogue webhooks from looping and spamming your service. This open-source Ingress Controller works with Palette to provide ingress to your applications, APIs, or other resources while also offloading network ingress and middleware execution to ngrok's platform. Balance traffic between multiple redundant Points of Presence (PoPs) in ngrok’s global network, and rely on ngrok’s built-in global service load balancer to automatically route traffic to the PoP with the lowest latency. The ngrok Ingress Controller for Kubernetes equips you to serve apps and APIs without needing to configure networking details such as ELBs, IPs, network interfaces, or VPC routing, radically simplifying ingress into Kubernetes.

Versions Supported

  • 0.9.0

Prerequisites

  • An active ngrok account.
    • An ngrok authentication token. You can find your token in the dashboard. Visit the Your Authtoken section to review your access token.
    • An ngrok API key. You can generate an API key from the ngrok dashboard. Visit the API section of the dashboard to review existing keys.
  • A static subdomain. You can obtain a static subdomain by navigating to the Domains section of the ngrok dashboard and clicking on Create Domain or New Domain.

Parameters

To deploy the ngrok Ingress Controller, you need to set, at minimum, the following parameters in the pack's YAML.

NameDescription
kubernetes-ingress-controller.credentials.apiKeyYour ngrok API key for this application and domain.
kubernetes-ingress-controller.credentials.authtokenThe authentication token for your active ngrok account.
kubernetes-ingress-controller.rules.hostA static subdomain hosted by ngrok and associated with your account.
kubernetes-ingress-controller.rules.http.paths.pathThe path at which to route traffic to your application. For more advanced configurations, you can set multiple paths with corresponding pathType, backend.service.name, and backend.service.name parameters.
kubernetes-ingress-controller.rules.host.paths.pathTypeSpecify how ingress paths should be matched by type. Prefix matches based on a URL path prefix split by /. Exact matches the URL path exactly and with case sensitivity.
kubernetes-ingress-controller.rules.host.backend.service.nameThe name you've given to the application for which the ngrok Ingress Controller should handle traffic.
kubernetes-ingress-controller.rules.host.backend.service.port.numberThe port number for the deployed service.name.

Review the common overrides document for more details on parameters. Refer to the user guide for advanced configurations.

warning

If you have a free ngrok account, you can only have one ngrok agent active at a time. This means that you will need to set the number of replicas to 1 to ensure that your ngrok agent operates properly.

charts:
kubernetes-ingress-controller:
replicaCount: 1

Usage

To use the ngrok Ingress Controller pack, first create a new add-on cluster profile, search for the ngrok Ingress Controller pack, and overwrite the default pack configuration with your API key and authentication token like the following example YAML content:

charts:
kubernetes-ingress-controller:
...
credentials:
apiKey: API_KEY
authtoken: AUTHTOKEN

Next, you must create an ingress service definition for your application, which requires a new manifest layer. Click on the Add Manifest button to create a new manifest layer.

The following YAML content demonstrates an example ingress service where the ngrok Ingress Controller creates a new edge to route traffic on your ngrok subdomain example.com to an existing example-app deployed on your Kubernetes cluster in Palette.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
namespace: ngrok-ingress-controller
spec:
ingressClassName: ngrok
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: example-app
port:
number: 80

Once you have defined the ngrok Ingress Controller pack, you can add it to an existing cluster profile, as an add-on profile, or as a new add-on layer to a deployed cluster.

Terraform

You can reference the ngrok Ingress Controller pack in Terraform with a data resource.

data "spectrocloud_registry" "public_registry" {
name = "Public Repo"
}
data "spectrocloud_pack_simple" "ngrok-ingress" {
name = "ngrok-ingress-controller"
version = "0.9.0"
type = "operator-instance"
registry_uid = data.spectrocloud_registry.public_registry.id
}

References