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 permissionscloudflare-account-id: Account tag/UUID from the dashboard URL (/accounts/\<ACCOUNT_ID>)cloudflare-tunnel-token: Tunnel token created bycloudflare/cloudflare-tunnelon first run (distinct from API token)
Links
- Provider docs: https://developers.cloudflare.com/dns/
- Tunnel API docs: https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/get-started/create-remote-tunnel-api/
Templates
DNS record template
Save asexample-record.yaml (see src/cloudflare/example-record.yaml):
Tunnel: single app
Save asexample-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:- DNS changes can take up to 24 hours to propagate globally
- Use Cloudflare’s development mode for testing to bypass cache
Best Practices
- API Token Security: Use restricted API tokens with minimal required permissions
- Zone Organization: Group related DNS records in logical namespaces
- CDN Optimization: Use page rules to optimize caching for different content types
- Security First: Enable firewall rules and rate limiting for sensitive endpoints
- 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
- Cloudflare Documentation: DNS API Reference
- API Documentation: Cloudflare API v4
- Community: Cloudflare Community
- Status Page: Cloudflare Status

