Skip to main content

CRDs

Kubernetes has the concept of Custom Resource Definitions (CRDs) which allow you to define your own custom resources. This document will cover the CRDs you might use to achieve your goals with the ngrok Kubernetes Operator.

Warning: There are other CRDs not documented here that are used internally by the controller. It is not recommended to edit these, but inspecting them to query the state of the system could be useful at times. See the internal CRDs document for more details.

Ngrok Module Sets

NgrokModuleSets is a CRD that lets you define combinations of ngrok modules that can be set on your ingress objects and applied to all of their routes. For an in-depth guide on configuring NgrokModuleSets see the Route Modules Guide.

NgrokModuleSetModules

FieldTypeDescription
compressionEndpointCompressionConfiguration for compression for this module
headersEndpointHeadersConfiguration for headers for this module
ipRestrictionEndpointIPPolicyConfiguration for IP restriction for this module
tlsTerminationEndpointTLSTerminationAtEdgeConfiguration for TLS termination for this module
webhookVerificationEndpointWebhookVerificationConfiguration for webhook verification for this module

NgrokModuleSet

FieldTypeDescription
apiVersionstringAPI version of the NgrokModuleSet custom resource definition
kindstringKind of the custom resource definition
metadataObjectMetaStandard Kubernetes metadata
modulesNgrokModuleSetModulesThe set of modules for this custom resource definition

NgrokTrafficPolicy

FieldTypeDescription
apiVersionstringAPI version of the NgrokTrafficPolicy
kindstringKind of the custom resource definition
metadataObjectMetaStandard Kubernetes metadata
policyjson.RawMessageSee policy configuration

EndpointCompression

FieldTypeDescription
enabledbooleanWhether or not compression is enabled for this endpoint

EndpointIPPolicy

FieldTypeDescription
ippolicies[]stringList of IP policies for this endpoint

EndpointRequestHeaders

FieldTypeDescription
addmap[string]stringMap of header key to header value that will be injected into the HTTP Request
remove[]stringList of header names that will be removed from the HTTP Request

EndpointResponseHeaders

FieldTypeDescription
addmap[string]stringMap of header key to header value that will be injected into the HTTP Response
remove[]stringList of header names that will be removed from the HTTP Response

EndpointHeaders

FieldTypeDescription
requestEndpointRequestHeadersConfiguration for request headers for this endpoint
responseEndpointResponseHeadersConfiguration for response headers for this endpoint

EndpointTLSTerminationAtEdge

FieldTypeDescription
minVersionstringMinimum TLS version to allow for connections to the edge

SecretKeyRef

FieldTypeDescription
namestringName of the Kubernetes secret
keystringKey in the secret to use

EndpointWebhookVerification

FieldTypeDescription
providerstringString indicating which webhook provider will be sending webhooks to this endpoint
secretSecretKeyRefReference to a secret containing the secret used to validate requests from the given provider

IP Policies

The IPPolicy CRD manages the ngrok API resource directly. It is a first class CRD that you can manage to control these policies in your account.

It's optional to create IP Policies this way vs using the ngrok dashboard or terraform provider. Once created though, you can use it in your ingress objects using the annotations.

FieldDescriptionRequiredTypeExample
metadataStandard object metadataNometav1.ObjectMetaname: my-ip-policy
spec.descriptionDescription for the IP policyNostring{}
spec.metadataMetadata for the IP PolicyNostring{}
spec.rulesA list of rules that belong to the policyNo[]IPPolicyRule[{cidr: "1.2.3.4", action: "allow"}]
status.idThe unique identifier for this policyNostring"my-ip-policy-id"
status.rulesA list of IP policy rules and their statusNo[]IPPolicyRuleStatus[{id: "my-rule-id", cidr: "1.2.3.4", action: "allow"}]

IPPolicyRule

FieldDescriptionRequiredTypeExample
cidrThe CIDR block that the rule applies toYesstring"1.2.3.4/24"
actionThe action to take for the rule, either "allow" or "deny"Yesstring"allow"

IPPolicyRuleStatus

FieldDescriptionRequiredTypeExample
idThe unique identifier for this ruleNostring"my-rule-id"
cidrThe CIDR block that the rule applies toNostring"1.2.3.4/24"
actionThe action to take for the rule, either "allow" or "deny"Nostring"allow"

TCP Edges

The Kubernetes ingress spec does not directly support TCP traffic. The ngrok Kubernetes Operator supports TCP traffic via the TCP Edge resource. This is a first class CRD that you can manage to control these edges in your account. See the TCP and TLS Edges guide for more details.

FieldTypeRequiredDescription
apiVersionstringYesThe API version for this custom resource.
kindstringYesThe kind of the custom resource.
metadatametav1.ObjectMetaNoStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions#metadata
specTCPEdgeSpecYesSpecification of the TCP edge.
statusTCPEdgeStatusNoObserved status of the TCP edge.

TCPEdgeSpec

FieldTypeRequiredDescription
descriptionstringNoA human-readable description of the edge.
metadatastringNoMetadata for the edge.
backendTunnelGroupBackendYesThe definition for the tunnel group backend that serves traffic for this edge.
ipRestrictionEndpointIPPolicyNoAn IPRestriction to apply to this route.

TunnelGroupBackend

FieldTypeRequiredDescription
descriptionstringNoA human-readable description of the backend.
metadatastringNoMetadata for the backend.
labelsmap[string]stringNoLabels to watch for tunnels on this backend.

TCPEdgeStatus

FieldTypeRequiredDescription
idstringNoThe unique identifier for this edge.
uristringNoThe URI of the edge.
hostports[]stringNoHostports served by this edge.
backendTunnelGroupBackendStatusNoStores the status of the tunnel group backend, mainly the ID of the backend.

TunnelGroupBackendStatus

FieldTypeRequiredDescription
idstringNoThe unique identifier for this backend.

TLS Edges

ngrok's TLS Edges function similarly to TCP Edges in that they may contain arbitrary application data, not just HTTP. As such, the Kubernetes Ingress spec isn't a perfect fit for them either. The ngrok Kubernetes Operator supports arbitrary TLS endpoints via the TLS Edge resource. This is a first class CRD that you can manage to control these edges in your account. See the TCP and TLS Edges guide for more details.

FieldTypeRequiredDescription
apiVersionstringYesThe API version for this custom resource.
kindstringYesThe kind of the custom resource.
metadatametav1.ObjectMetaNoStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions#metadata
specTLSEdgeSpecYesSpecification of the TCP edge.
statusTLSEdgeStatusNoObserved status of the TCP edge.

TLSEdgeSpec

FieldTypeRequiredDescription
descriptionstringNoA human-readable description of the edge.
metadatastringNoMetadata for the edge.
backendTunnelGroupBackendYesThe definition for the tunnel group backend that serves traffic for this edge.
hostports[]stringYesA list of hostports served by this edge.
ipRestrictionEndpointIPPolicyNoAn IPRestriction to apply to this edge.
tlsTerminationTLSTerminationNoTLS Termination behaviour for this edge.
mutualTlsMutualTLSNoMutual TLS validation for this edge.

TLSEdgeStatus

FieldTypeRequiredDescription
idstringNoThe unique identifier for this edge.
uristringNoThe URI of the edge.
hostports[]stringNoHostports served by this edge.
backendTunnelGroupBackendStatusNoStores the status of the tunnel group backend, mainly the ID of the backend.

Domains

Domains are automatically created by the controller based on the ingress objects host values. Standard ngrok subdomains will automatically be created and reserved for you. Custom domains will also be created and reserved, but will be up to you to configure the DNS records for them. See the custom domain guide for more details.

If you delete all the ingress objects for a particular host, as a safety precaution, the Operator does NOT delete the domains and thus does not unregister them. This ensures you don't lose domains while modifying or recreating ingress objects. You can still manually delete a domain CRD via kubectl delete domain <name> if you want to unregister it.

If using a TCP or TLS CRD directly, a Domain will not be created for you automatically, so you will need to create and manage it yourself. See the TCP and TLS Edges guide for details.

FieldTypeRequiredDescription
apiVersionstringYesThe API version for this custom resource.
kindstringYesThe kind of the custom resource.
metadatametav1.ObjectMetaNoStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions#metadata
specDomainSpecYesSpecification of the domain.
statusDomainStatusNoObserved status of the domain.

DomainSpec

FieldTypeRequiredDescription
descriptionstringNoA human-readable description of the domain.
metadatastringNoMetadata for the domain.
domainstringYesThe domain name to reserve.
regionstringYesThe region in which to reserve the domain.

DomainStatus

FieldTypeRequiredDescription
idstringNoThe unique identifier of the domain.
domainstringNoThe domain that was reserved.
regionstringNoThe region in which the domain was created.
uristringNoThe URI of the reserved domain API resource.
cnameTargetstringNoThe CNAME target for the domain.

Tunnels

Tunnels are automatically created by the controller based on the ingress objects' rules' backends. A tunnel will be created for each backend service name and port combination. This results in tunnels being created with those labels which can be matched by various edge backends. Automatically-created are useful to inspect but are fully managed by the controller and should not be edited directly.

If using a TCP or TLS CRD, you may need to create and manage a Tunnel yourself. See the TCP and TLS Edges guide for details.

FieldTypeRequiredDescription
apiVersionstringYesThe API version for this custom resource.
kindstringYesThe kind of the custom resource.
metadatametav1.ObjectMetaNoStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions#metadata
specTunnelSpecYesSpecification of the tunnel.
statusTunnelStatusNoObserved status of the tunnel.

TunnelSpec

FieldTypeRequiredDescription
forwardsTostringYesThe name and port of the service to forward traffic to.
backendTunnelBackendYesThe type of backend this tunnel forwards to.
labelsmap[string]stringNoKey/value pairs that are attached to the tunnel.

TunnelBackend

FieldTypeRequiredDescription
protocolstringYesThe protocol understood by this backend. Either TCP or TLS.

TunnelStatus

FieldTypeRequiredDescription
No fields defined.

Agent Endpoints

Agent endpoints are ephemeral endpoints tied to the lifetime of the agent. When used with the ngrok Kubernetes operator, this means that the Agent Endpoints are tied to the operator's operator-agent pod (which is deployed by default when installing the operator). The operator will manage, create, and delete agent endpoints for you according to the configuration of the AgentEndpoint custom resources you create. So long as at least one instance of the operator-agent pod is running, your agent endpoints will be available. You may occasionally notice the IDs of Agent Endpoints managed by the operator change if the operator pods restart, this will not halt traffic through your agent endpoints unless all of the operator pods have stopped.

See the ngrok agent CLI configuration page, for more information about using the CLI to start agent endpoints outside of Kubernetes.

Note: Agent Endpoints are currently in feature-preview for the ngrok Kubernetes operator. You will need to use --version 0.17.0-rc.1 (or newer) when using helm to install or update the operator. See the deployment guide for information about installing the ngrok Kubernetes operator.

FieldTypeRequiredDescription
apiVersionstringYesThe API version for this custom resource.
kindstringYesThe kind of the custom resource.
metadatametav1.ObjectMetaNoStandard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions#metadata
specAgentEndpointSpecYesSpecification of the agent endpoint.

AgentEndpointSpec

FieldTypeRequiredDescription
urlstringYesThe unique URL for this agent endpoint. This URL is the public address
upstreamEndpointUpstreamYesDefines the destination for traffic to this agent endpoint
trafficPolicyTrafficPolicyCfgNoAllows configuring a TrafficPolicy to be used with this AgentEndpoint. When configured, the traffic policy is provided inline or as a reference to an NgrokTrafficPolicy resource
descriptionstringNoHuman-readable description of this agent endpoint
metadatastringNoString of arbitrary data associated with the object in the ngrok API/Dashboard
bindings[]stringNoList of Binding IDs to associate with the endpoint. Accepted values are "public", "internal", or strings matching the pattern "k8s/*"

url notes

The following formats are accepted:

Domain - example.org

  • When using the domain format you are only defining the domain. The scheme and port will be inferred.

Origin - https://example.ngrok.app or https://example.ngrok.app:443 or tcp://1.tcp.ngrok.io:12345 or tls://example.ngrok.app

  • When using the origin format you are defining the protocol, domain and port. HTTP endpoints accept ports 80 or 443 with respective protocol.

Scheme (shorthand) - https:// or tcp:// or tls:// or http://

  • When using scheme you are defining the protocol and will receive back a randomly assigned ngrok address.

Internal - some.domain.internal

  • When ending your url with .internal, an internal endpoint will be created.
  • Internal Endpoints cannot be accessed directly, but rather can only be accessed using the forward-internal traffic policy action.

EndpointUpstream

FieldTypeRequiredDescription
urlstringYesThe local or remote address you would like to incoming traffic to be forwarded to
protocolenum(string)NoSpecifies the protocol to use when connecting to the upstream. Currently only http1 and http2 are supported with prior knowledge (defaulting to http1)
proxyProtocolVersionenum(string)NoOptionally specify the version of proxy protocol to use if the upstream requires it

upstream.url notes

The following formats are supported:

Origin - https://example.org or http://example.org:80 or tcp://127.0.0.1:80

  • When using the origin format you are defining the protocol, domain and port
  • When no port is present and scheme is https or http the port will be inferred
    • For https port will be 443
    • For http port will be 80

Domain - example.org

  • This is only allowed for https and http endpoints. For tcp and tls endpoints host and port is required
  • When using the domain format you are only defining the host
  • Scheme will default to http
  • Port will default to 80

Scheme (shorthand) - https://

  • This only works for https and http
  • For tcp and tls host and port is required
  • When using scheme you are defining the protocol and the port will be inferred on the local host
    • For https port will be 443
    • For http port will be 80
    • Host will be localhost

Port (shorthand) - 8080

  • When using port you are defining the port on the local host that will receive traffic
  • Scheme will default to http
  • Host will default to localhost

TrafficPolicyCfg

Configuration for a traffic policy that may be provided inline or via a reference to an NgrokTrafficPolicy resource in the Kubernetes cluster. See policy configuration for traffic policy configuration options

FieldTypeRequiredDescription
inlinejson.RawMessageNoProvides an inline traffic policy for the agent endpoint
targetRefK8sObjectRefNoIdentifies an NgrokTrafficPolicy custom resource by name to use as the traffic policy config for the agent endpoint

K8sObjectRef

FieldTypeRequiredDescription
namestringYesIdentifies a kubernetes resource by name. This resource and the referenced resource must be in the same namespace.