Table of Contents

# Use Cloudflare tunnel

When needing to expose private network services, we can use the cloudflare as the entrance and tunnel to the service.

Install cloudflared

Install it to any point needing access to the service.

Install cloudflared with the package manager or copy the installation script from building tunnels in the Cloudflare tunnel page.

Choco install cloudflared

choco install cloudflared

Expose service

In Cloudflare management web pages, Zero Trust > Network > Tunnel.

Steps:

  1. Create a tunnel resource, get the token and register to the cloudflared instance.
  2. Create expose services into the tunnel, including DNS and the backend host and port.
  3. Then you can access the service via the tunnel. (Only works for http(s) backend)

Tunnel Non-HTTP remote service into a local port

Access ssh

cloudflared access ssh --hostname <domain>

Tunnel a tcp port

cloudflared access tcp --hostname host-01-cluster.davidhsaiou.com `
--url localhost:6443 `
--log-level debug

Reference