kubernetes
.
Quickstart
Create a Kubernetes endpoint by specifying binding ofkubernetes
when you
create an endpoint.
1. Install the ngrok Kubernetes Operator
2. Create a new namespace
3. Create an ngrok endpoint
Run the following command in the same ngrok account to create the kubernetes bound endpoint. After the command completes, the ngrok operator will createService
objects in the kubernetes cluster matching the
endpoint’s URL.
4. Connect to the endpoint
Other pods in the Kubernetes cluster where the ngrok operator is running can connect to the bound endpoint.URLs
Kubernetes endpoint URL hostnames must be in the following format:[http|tcp]://name.namespace[:port]
- Scheme - Must be
http
ortcp
.https
andtls
are not supported. - Hostname - Hostnames must always be two parts separated by a single dot,
e.g.
foo.bar
. Wildcard hostnames are not allowed. - Port - All port numbers [1-65535] are valid. Port must be specified for
tcp
endpoints. - Namespacing - Kubernetes endpoints are namespaced on a per-account basis. Two accounts may have kubernetes endpoints with the same URL (e.g. http://api.internal). Those endpoints will not conflict or pool.
URL examples
http://app.example
http://app.example:12345
tcp://app.example:443
tcp://app.example:12345
https://app.example
- invalid schemehttps
tls://app.example:12345
- invalid schemetls
http://app.foo.bar
- invalid hostname, must have only two partstcp://app.example
- tcp endpoint must specify port number
Types and pooling
- Kubernetes endpoints support all Endpoint
Types (
agent
andcloud
). - Kubernetes endpoints support Endpoint Pooling.
Service creation
After a kubernetes-bound endpoint is created, the ngrok cloud service notifies Kubernetes Operators that a new kubernetes-bound endpoint exists. Kubernetes Operators createv1.Service
objects in their Kubernetes clusters which
forward traffic they receive to the operators’ pods.
Cluster IP service
A Cluster IP service is created in the operator’s namespace.External Name service
An External Name service is created in the namespace targeted by the second part of the URL’s hostname.How to update endpoint selectors
If you don’t want all kubernetes endpoints in your account to appear inside of a cluster, you may specify an Endpoint Selector which filters which Kubernetes endpoints are projected into the cluster it runs in. Endpoint Selectors are a CEL expression which is evaluated against each Kubernetes Endpoint in your account. The operator will only projects endpoints that the selector returnstrue
for.
See the docs on enabling bindings to learn more.