Reach private Services over Cloudflare WARP
Serve a Service only to WARP devices through a private Gateway listener, with Envoy terminating TLS and virtual networks and routes as CRDs.
The private path uses the same Gateway, HTTPRoute, and AccessApplication objects as a public one. Live acceptance of the private-hostname answer by the Cloudflare edge has not been verified; see Limits and What is not verified live.
This page serves admin.internal.example from the flareway-platform namespace, where the shared Access objects from Protect a route with Cloudflare Access already live. A private listener needs a VirtualNetwork in its own namespace, and only a namespace whose grant sets platformObjects: Allowed can manage one, so the private Gateway, its routes, and its Access applications all live there. The manifests are the samples in config/samples/. Replace every ID, name, and hostname with your own.
Before you start
Section titled “Before you start”Your Cloudflare account needs:
gatewayProxyEnabledandgatewayUdpProxyEnabledturned on in the account’s device settings. Flareway reads them from Cloudflare before it programs a private listener.- a device profile in Include mode that includes the private hostname ranges, if you use Include mode;
- no overlap between a hostname route and a fallback DNS suffix;
- a compatible WARP client and Cloudflare plan.
The API token needs the Private network capability (read and write virtual networks, CIDR routes, and private hostname routes) and read access to device settings. Connect a Cloudflare account lists every capability.
This page also uses the flareway-platform grant from Connect a Cloudflare account and the Access policies from Protect a route with Cloudflare Access.
Create the Service and certificate
Section titled “Create the Service and certificate”flareway_v1alpha1_cloudflareaccount.yaml creates flareway-platform with the label flareway.bhyoo.com/allow-origin-jwt-disable: "true", which approves the originJWT.mode: Disabled application in Protect it with Access.
In flareway-platform, you also need:
- a Service named
demo-adminthat serves HTTP on port9090, or change theHTTPRoutebackend below to a Service you already run; - a TLS Secret named
admin-internal-tlsforadmin.internal.example. Envoy serves this certificate to WARP devices, so they must trust it. Flareway does not issue certificates; use cert-manager or an internal CA.
Check the grant
Section titled “Check the grant”The flareway-platform grant from Connect a Cloudflare account already covers this page:
- namespaceSelector: matchLabels: kubernetes.io/metadata.name: flareway-platform hostnames: - "*.direct.example.com" - "*.internal.example" zones: - example.com exposures: - Public - Private unprotectedHostnames: - "*.direct.example.com" privateRoutes: networkRouteSelector: matchLabels: flareway.bhyoo.com/private-route: platform hostnameRouteSelector: matchLabels: flareway.bhyoo.com/private-route: platform backends: namespaces: Same kinds: - Service platformObjects: AllowedEach field opens one gate for this page:
*.internal.exampleinhostnamesandPrivateinexposuresallow the private listener. A grant needs at least one zone; Flareway does not check private hostnames againstzones.privateRoutesselects theHostnameRouteandNetworkRouteobjects the namespace may use, by theirflareway.bhyoo.com/private-route: platformlabel.backendslets theHTTPRoutesend traffic to Services inflareway-platform.platformObjects: Allowedletsflareway-platformholdVirtualNetwork,HostnameRoute,NetworkRoute, andWARPConnectorobjects.
The applications on this page reference policies in their own namespace, so they need no accessPolicyRefs. admin.internal.example is not in unprotectedHostnames, so the hostname stays blocked until an AccessApplication protects it. The security model explains why grants and Kubernetes RBAC must both allow each object.
Declare the virtual network and routes
Section titled “Declare the virtual network and routes”A VirtualNetwork owns one account-scoped Cloudflare virtual network. A private listener uses a virtual network from its own namespace: the one its tunnel listener names in virtualNetworkRef, or, without a reference, the one with isDefault: true. This is flareway_v1alpha1_virtualnetwork.yaml:
apiVersion: flareway.bhyoo.com/v1alpha1kind: VirtualNetworkmetadata: name: private-services namespace: flareway-platformspec: accountRef: name: example-account name: private-services isDefault: false comment: Example private services managementPolicy: Managed deletionPolicy: OrphanA HostnameRoute sends one private hostname to the tunnel. This is private-admin from flareway_v1alpha1_hostnameroute.yaml:
apiVersion: flareway.bhyoo.com/v1alpha1kind: HostnameRoutemetadata: name: private-admin namespace: flareway-platform labels: flareway.bhyoo.com/private-route: platformspec: accountRef: name: example-account hostname: admin.internal.example tunnelRef: kind: CloudflareTunnel name: private-gateway namespace: flareway-platform allowedNamespaces: from: Same comment: Private admin hostname through the Gateway tunnel managementPolicy: Managed deletionPolicy: DeleteA NetworkRoute sends a CIDR to the tunnel, here the Kubernetes Service range. This is private-services from flareway_v1alpha1_networkroute.yaml; its virtualNetworkRef names the VirtualNetwork above, which must be in the route’s own namespace:
apiVersion: flareway.bhyoo.com/v1alpha1kind: NetworkRoutemetadata: name: private-services namespace: flareway-platform labels: flareway.bhyoo.com/private-route: platformspec: accountRef: name: example-account network: 10.96.0.0/12 tunnelRef: kind: CloudflareTunnel name: private-gateway namespace: flareway-platform virtualNetworkRef: name: private-services allowedNamespaces: from: Same comment: Kubernetes Service CIDR through the Gateway tunnel managementPolicy: Managed deletionPolicy: DeletetunnelRef.kind is CloudflareTunnel or WARPConnector and defaults to CloudflareTunnel. Without virtualNetworkRef, a route uses the account’s default virtual network. allowedNamespaces decides which namespaces the route admits: the referenced tunnel’s namespace must be admitted, and so must the namespace of any DeviceProfile that includes the route. With from: Same, the tunnel must be in the route’s namespace. An AccessApplication references a route in its own namespace. The routes wait with Pending until the tunnel below exists and is accepted.
A private listener can also get its HostnameRoute automatically: by default, Flareway creates one in its own namespace for each private listener hostname. This page declares private-admin itself and turns that off with hostnameRoute.create: false.
Add the private listener
Section titled “Add the private listener”This is gateway_v1_private_gateway.yaml. The tunnel listener’s virtualNetworkRef points the listener at private-services.
apiVersion: flareway.bhyoo.com/v1alpha1kind: CloudflareTunnelmetadata: name: private-gateway namespace: flareway-platformspec: accountRef: name: example-account tunnel: name: flareway-example-private-gateway configuration: # Gateway owns the complete remote ingress program for this tunnel. mode: Gateway managementPolicy: Managed deletionPolicy: Delete dns: mode: External listeners: - name: admin-private exposure: Private virtualNetworkRef: name: private-services hostnameRoute: create: false---apiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata: name: private-gateway namespace: flareway-platformspec: gatewayClassName: flareway infrastructure: parametersRef: group: flareway.bhyoo.com kind: CloudflareTunnel name: private-gateway listeners: - name: admin-private hostname: admin.internal.example port: 443 protocol: HTTPS tls: mode: Terminate certificateRefs: - kind: Secret name: admin-internal-tls allowedRoutes: namespaces: from: Same---apiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata: name: private-admin namespace: flareway-platformspec: parentRefs: - name: private-gateway sectionName: admin-private hostnames: - admin.internal.example rules: - backendRefs: - name: demo-admin port: 9090A private listener needs three things:
protocol: HTTPSwith acertificateRefsSecret. Envoy terminates TLS for private listeners, the reverse of public listeners, where Cloudflare owns edge TLS.- a
CloudflareTunnel.spec.listeners[]entry with the same name andexposure: Private. - the port that clients dial. Envoy binds to the listener’s declared port, here
443, because Cloudflare forwards the original destination port. Another port would break the WARP destination and the AccessportRange.
One Gateway cannot expose the same hostname as both public and private; the tunnel reports Accepted=False with “hostname exposure must be unique per Gateway”. dns.mode: External fits a private-only tunnel, which needs no public DNS record.
Protect it with Access
Section titled “Protect it with Access”The hostname forwards no traffic until an AccessApplication protects it. Private hostnames take the same AccessApplication as public ones, with one difference: cloudflared does not check them, so Envoy’s jwt_authn filter is the only origin JWT check. Cloudflare can add the Access JWT to private traffic only when Zero Trust Gateway TLS decryption is on. Flareway does not observe that setting, so an application with originJWT.mode: Required on a private listener stays blocked and unprogrammed until you set originJWT.assumeGatewayTLSDecryption: true. That field records the platform’s promise that decryption is on.
This is private-https from flareway_v1alpha1_accessapplication_private.yaml. A targetRefs application must share its Gateway’s namespace, and it uses the policies from the Protect guide in the same namespace:
apiVersion: flareway.bhyoo.com/v1alpha1kind: AccessApplicationmetadata: name: private-https namespace: flareway-platformspec: accountRef: name: example-account type: SelfHosted selfHosted: {} targetRefs: - group: gateway.networking.k8s.io kind: Gateway name: private-gateway sectionName: admin-private application: name: Private HTTPS sessionDuration: 720h allowAuthenticateViaWarp: true appLauncherVisible: false policies: - policyRef: name: allow-developers-warp - policyRef: name: deny-everyone originJWT: mode: Disabled managementPolicy: Managed deletionPolicy: Deleteprivate-https protects the private listener with Access at the edge only, because originJWT.mode is Disabled; the flareway-platform namespace label allows that. For an origin JWT check on this listener, turn on Zero Trust Gateway TLS decryption and set originJWT.mode: Required with assumeGatewayTLSDecryption: true. Security model compares the public and private checks.
How resolution works
Section titled “How resolution works”A Gateway with private listeners gets a CoreDNS sidecar in its data-plane Pod. The sidecar answers private hostnames with 127.0.0.1, so WARP traffic that arrives through cloudflared goes to Envoy on loopback. Envoy terminates TLS with your certificate and applies the HTTPRoute rules.
The tunnel’s PrivateListenerDegraded condition reports how the listener is bound:
| Status and reason | Meaning |
|---|---|
False, Loopback |
Private listeners are isolated on Pod loopback. |
False, Pending |
A private prerequisite is missing; the message names it, such as a missing virtual network or HostnameRoute. |
True, PodIPFallback |
The listener uses the Pod IP instead of loopback and relies on NetworkPolicy isolation. Verify the NetworkPolicy before you treat the listener as ready. |
Verify
Section titled “Verify”Check the Gateway, the tunnel, the application, and the private-network objects:
kubectl -n flareway-platform get gateway private-gatewaykubectl -n flareway-platform get cloudflaretunnel private-gateway \ -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'kubectl -n flareway-platform get accessapplication private-httpskubectl -n flareway-platform get virtualnetwork,hostnameroute,networkrouteWhen the Gateway reports Programmed=True, request the hostname from an enrolled WARP device. Cloudflare Access evaluates the request against the policies, and an allowed request reaches demo-admin:
curl https://admin.internal.example/Protect a private CIDR
Section titled “Protect a private CIDR”An AccessApplication can also protect a CIDR behind a NetworkRoute, without a Gateway target. This is private-l4 from flareway_v1alpha1_accessapplication_private.yaml. It lives in flareway-platform next to its route, and its cidr lies inside the route’s 10.96.0.0/12:
apiVersion: flareway.bhyoo.com/v1alpha1kind: AccessApplicationmetadata: name: private-l4 namespace: flareway-platformspec: accountRef: name: example-account type: SelfHosted selfHosted: {} destinations: - type: Private private: networkRouteRef: name: private-services # cidr must lie inside the NetworkRoute network (10.96.0.0/12). cidr: 10.96.0.0/16 portRange: "443" l4Protocol: TCP application: name: Private L4 service sessionDuration: 720h allowAuthenticateViaWarp: true appLauncherVisible: false policies: - policyRef: name: allow-developers-warp - policyRef: name: deny-everyone originJWT: mode: Required assumeGatewayTLSDecryption: true managementPolicy: Managed deletionPolicy: DeletenetworkRouteRef names a route in the application’s namespace. cidr must lie inside the route’s network, or the application reports RefNotPermitted; without cidr, the application covers the whole route. Cloudflare Access checks this traffic at the edge only: the traffic does not pass through Envoy’s jwt_authn filter, so the originJWT block has no effect and the application’s OriginJWTEnforced condition reports NotApplicable.
Connect another site with WARPConnector
Section titled “Connect another site with WARPConnector”A WARPConnector links another network, such as a branch office or a VPC, to your Cloudflare account. It is a separate Cloudflare Mesh connector with no Gateway data plane. Flareway creates it and stores its bootstrap token in a Secret it owns, which status.tokenSecretRef names; you run the connector at that site with the token. From flareway_v1alpha1_warpconnector.yaml:
apiVersion: flareway.bhyoo.com/v1alpha1kind: WARPConnectormetadata: name: branch-local namespace: flareway-platformspec: accountRef: name: example-account name: flareway-example-branch-local highAvailability: enabled: true mode: Local local: vips: - address: 192.0.2.10 - address: 2001:db8::10 vipsPrevious: - address: 192.0.2.9 # Change requestId for each deliberate failover, including repeat failover to this client. failover: clientId: replace-with-linked-client-id requestId: replace-with-failover-request-id managementPolicy: Managed adoption: mode: None deletionPolicy: OrphanRoutes reach the site with tunnelRef.kind: WARPConnector. This is branch-office from flareway_v1alpha1_networkroute.yaml; it sends the branch CIDR to branch-local:
apiVersion: flareway.bhyoo.com/v1alpha1kind: NetworkRoutemetadata: name: branch-office namespace: flareway-platform labels: flareway.bhyoo.com/private-route: platformspec: accountRef: name: example-account network: 10.40.0.0/16 tunnelRef: kind: WARPConnector name: branch-local namespace: flareway-platform # virtualNetworkRef is optional; omission selects the account default virtual network. allowedNamespaces: from: Same comment: Branch CIDR through the local-HA WARP Connector managementPolicy: Managed deletionPolicy: DeletehighAvailability.enabled is set at creation and cannot change afterwards. mode is None, Disabled, AWS, or Local: AWS requires aws.fnrId, and Local requires at least one address in local.vips. A failover request needs a linked clientId and a new requestId each time.
What is not verified live
Section titled “What is not verified live”Tests measure the CoreDNS sidecar answering 127.0.0.1 locally. No run against a live Cloudflare account has verified that the Cloudflare edge and WARP accept that answer for a private hostname. The design’s fallback, in which the sidecar answers with the Pod IP and NetworkPolicy isolates Envoy, is reported as PrivateListenerDegraded=True. Limits lists this with the other boundaries.