Historically, exposing internal Kubernetes workloads required public IPv4 addresses, fragile port-forwarding rules, or expensive cloud provider Load Balancers.
With Cloudflare Tunnels (cloudflared), you can close all inbound firewall ports and establish secure, persistent outbound QUIC connections directly to Cloudflare’s global edge network.
1. Architectural Overview
Traffic flows purely outbound. The cloudflared daemon running as a lightweight Kubernetes Deployment connects to the nearest Cloudflare Point of Presence (PoP):
[ Client / Browser ]
│
▼ (HTTPS / Global Anycast / WAF)
[ Cloudflare Edge ]
▲
│ (Persistent Outbound QUIC Tunnel)
[ Pod: cloudflared ]
│
▼ (ClusterIP / Internal Ingress)
[ Service: Grafana / API ]
2. Kubernetes Deployment Configuration
Instead of managing local certificates or dynamic DNS scripts, create a tunnel secret in Cloudflare Zero Trust and mount the credentials:
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloudflared-tunnel
namespace: networking
spec:
replicas: 2
selector:
matchLabels:
app: cloudflared
template:
metadata:
labels:
app: cloudflared
spec:
containers:
- name: cloudflared
image: cloudflare/cloudflared:latest
args:
- tunnel
- --no-autoupdate
- run
- --token
- $(TUNNEL_TOKEN)
env:
- name: TUNNEL_TOKEN
valueFrom:
secretKeyRef:
name: tunnel-credentials
key: token
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 25m
memory: 64Mi
3. Key Takeaways
- Zero inbound ports open on your edge firewall or router.
- DDoS mitigation and edge SSL termination handled automatically by Cloudflare.
- 100% free under Cloudflare Zero Trust Free plan (up to 50 users).