Skip to main content

What is this integration?

Cloudflare provides globally distributed DNS, CDN, and edge services.

What Monk manages

  • DNS Zone and DNS Record
  • Cloudflare Tunnel
  • Cloudflare Tunnel Application

Credentials

  • cloudflare-api-token: Cloudflare API token with account/tunnel and DNS edit permissions
  • cloudflare-account-id: Account tag/UUID from the dashboard URL (/accounts/\<ACCOUNT_ID>)
  • cloudflare-tunnel-token: Tunnel token created by cloudflare/cloudflare-tunnel on first run (distinct from API token)

Templates

DNS record template

Save as example-record.yaml (see src/cloudflare/example-record.yaml):

Tunnel: single app

Save as example-tunnel.yaml (see src/cloudflare/example-tunnel.yaml):

Tunnel: multiple apps through one tunnel

Tunnel: cloudflared only (tunnel connector already exists)

Use this when you already have a tunnel token (in this case it’s in global secret cloudflare-tunnel-token) and just need to run cloudflared. You must create the tunnel and DNS records manually in Cloudflare for the hostname(s) in your ingress. Each hostname should have a CNAME record pointing to \<tunnel-id>.cfargotunnel.com. For a full setup that creates tunnels and DNS records, use the cloudflare/cloudflare-tunnel and cloudflare/cloudflare-tunnel-application entities instead.

Advanced Configuration Examples

DNS Zone Management

Page Rules for CDN Optimization

Firewall Rules

Troubleshooting

Common Issues

API token permission errors:
Zone not found errors:
DNS propagation delays:
  • DNS changes can take up to 24 hours to propagate globally
  • Use Cloudflare’s development mode for testing to bypass cache

Best Practices

  1. API Token Security: Use restricted API tokens with minimal required permissions
  2. Zone Organization: Group related DNS records in logical namespaces
  3. CDN Optimization: Use page rules to optimize caching for different content types
  4. Security First: Enable firewall rules and rate limiting for sensitive endpoints
  5. Monitoring: Enable Cloudflare Analytics to monitor traffic patterns

Integration with Other Services

Cloudflare works seamlessly with:
  • Monk Applications: Proxy traffic through Cloudflare’s global network
  • Load Balancers: Distribute traffic across multiple origins
  • CDNs: Combine with other CDNs for multi-layer caching
  • Security Tools: Integrate with WAF and DDoS protection services
  • Analytics: Feed traffic data into monitoring dashboards

Support & Resources