How it works
A Kubernetes-bound endpoint is a private endpoint only accessible inside clusters where you’ve installed the ngrok Kubernetes Operator. When you create one, the Operator automatically creates aService resource in your cluster that routes traffic to your endpoint.
This means:
- Your local service appears as a normal Kubernetes
Servicein the remote cluster - Other pods can make requests to it using standard service DNS
- No public exposure—traffic stays private through ngrok’s network
- No port forwarding or VPN configuration required
Prerequisites
- An ngrok account with an API key and authtoken
- The ngrok CLI installed on your local machine
- A local service running on a port you want to expose
- Access to a remote Kubernetes cluster
1. Set up the remote cluster
Install the ngrok Kubernetes Operator with bindings enabled:Restrict which endpoints can be projected (optional)
You can limit which Kubernetes-bound endpoints appear in your cluster using endpoint selectors. For example, to only allow endpoints matching*.staging:
2. Project your local service
With your local service running (for example, on port8080), create a Kubernetes-bound endpoint.
The ngrok CLI works best for if you’re not running the service in a local K8s cluster, like k3d or kind—for that, use the ngrok Kubernetes Operator on the local cluster as well.
- ngrok CLI
- Kubernetes Operator
http://<service-name>.<namespace>, which determines where the Service resource gets created in your cluster.Service named my-service in the staging namespace.
3. Test the connection
Verify the projected service is accessible from within your remote cluster:4. Redirect existing traffic to your local service
If other services in your cluster already communicate with a service you want to intercept, you can redirect their traffic to your local endpoint. For example, if afrontend deployment sends requests to a backend service configured via an environment variable:
-
Start your Kubernetes-bound endpoint with the same service name:
-
Update the frontend deployment to point to your projected service:
-
Restart the frontend pods:
frontend to BACKEND_URL route to your local machine.
When you make changes locally using your IDE, they’ll be instantly reflected in the remote cluster, and services in staging interact direct with your local version.
Test and iterate until you’re ready to create a pull request and push more formally to your CI/CD pipeline, then revert the environment variable, perform another rollout, and stop your ngrok agent to clean everything up.
What’s next
- Bindings: Learn about all binding types and how they work with the Operator
- Kubernetes endpoints: Deep dive into URL formats and service creation
- CloudEndpoint CRD: Create persistent Kubernetes-bound endpoints declaratively