Overview
Cloudflare Tunnel (cloudflared) provides secure access to internal services without opening any ports on the router. All traffic is routed through Cloudflare’s network.No port forwarding required. The tunnel creates an outbound connection to Cloudflare, which then routes incoming requests to your services.
How It Works
Architecture
| Component | Location | Role |
|---|---|---|
| Cloudflare Access | Cloudflare Edge | Authentication policies |
| cloudflared | Podman container on CoreOS | Tunnel daemon |
| Caddy | Podman container on CoreOS | Reverse proxy |
Deployment
Thecloudflared container runs as a Podman Quadlet on Fedora CoreOS.
Quadlet Configuration
Terraform Configuration
The tunnel is managed via Terraform:Integration with Cloudflare Access
All services behind the tunnel are protected by Cloudflare Access policies, which authenticate users via Authentik (OIDC). See Authentication for the full auth flow.Troubleshooting
Tunnel not connecting
Tunnel not connecting
Check the container logs:Common issues:
- Invalid or expired tunnel token
- Network connectivity issues
- DNS resolution problems
502 Bad Gateway
502 Bad Gateway
The tunnel is working but can’t reach the backend:
- Verify Caddy is running:
systemctl status caddy - Check the service URL in tunnel config matches Caddy’s listener
- Ensure containers are on the same network