Token Scopes
CloudflareGatewayConfiguration.spec.credentialSecretRef points at a Kubernetes Secret
holding a single Cloudflare API token, and that token is used for every Cloudflare API call
that configuration’s controllers make — including the credential check the controller runs
on every reconcile, which calls the account-scoped token-verify endpoint
(/accounts/{account_id}/tokens/verify). Create the token as an account-owned custom
token — from the dashboard, Manage Account → Account API Tokens → Create Token → Custom
Token — never a token created from My Profile → API Tokens (a user-owned token), and
never the legacy Global API Key. This project’s own end-to-end test token, and every live
test this page’s permission tables are derived from, is account-owned; there’s no evidence a
user-owned token works against the account-scoped verify endpoint the controller calls, so
don’t create one.
The tables below are the permission set this project’s own end-to-end test token holds, and
which its full test suite exercises successfully — sufficient, not claimed to be a
minimal set, since it hasn’t been rigorously pared down permission by permission. If you find
a narrower set that still works for your deployment, that’s expected; report a 403 against
the set below as a documentation issue rather than assuming your deployment is broken.
Permissions by mode
Section titled “Permissions by mode”| Permission | Access level |
|---|---|
| Account / Cloudflare Tunnel | Edit |
| Zone / DNS | Edit |
| Zone / Zone | Read |
| Zone / SSL and Certificates | Read |
Tunnel Mode creates and manages the cloudflared tunnel itself (Account / Cloudflare
Tunnel), the routing DNS records that point at it (Zone / DNS), and reads each target zone’s
identity and certificate coverage (Zone / Zone, Zone / SSL and Certificates) to back its
CertificateCoverageInsufficient health check. It never orders or modifies a certificate —
the SSL and Certificates permission is read-only.
| Permission | Access level |
|---|---|
| Zone / DNS | Edit |
| Zone / Zone | Read |
DNS Mode never calls the Cloudflare Tunnel or SSL and Certificates APIs — it only creates the
load-balancer-address DNS records Envoy Gateway’s Gateway addresses resolve to. Certificates
in DNS Mode are issued by cert-manager’s own ACME flow, not by this project; see
cert-manager’s own token below.
Neither mode needs Account-level DNS, Zone-level Tunnel, write access to SSL/Certificates, Firewall, WAF, Page Rules, Workers, or any permission group this project doesn’t call.
Access permissions (only if you use Access)
Section titled “Access permissions (only if you use Access)”If you use CloudflareAccessIdentityProvider, CloudflareAccessServiceToken,
CloudflareAccessApplication, or CloudflareAccessPolicy to protect a route with Cloudflare
Access, the token also needs these four Access permissions — identical for both modes, since
Access is account-level rather than mode-specific:
| Permission | Access level |
|---|---|
| Account / Access: Identity Providers | Edit |
| Account / Access: Organizations, Identity Providers, and Groups | Read |
| Account / Access: Apps and Policies | Edit |
| Account / Access: Service Tokens | Edit |
Mutual TLS (mTLS) client-certificate authentication is not supported by this project, so no
mTLS-related permission is needed. A device-posture rule can be referenced by UUID in a
CloudflareAccessPolicy, but the controller never calls a Device Posture endpoint itself —
the UUID passes straight through into the policy it writes, unvalidated — so no
“Access: Device Posture” permission is needed either, even though this project’s own
end-to-end test token happens to hold it. (This project’s own live testing found that grant
doesn’t even permit listing posture rules against this account’s token, so it isn’t load-
bearing for anything the controller does.) If you don’t use Access at all, omit all four rows
above — a deployment with no CloudflareAccessIdentityProvider/CloudflareAccessServiceToken/
CloudflareAccessApplication/CloudflareAccessPolicy objects never calls any Access
endpoint.
Account Resources and Zone Resources scoping
Section titled “Account Resources and Zone Resources scoping”An account-owned token created via Manage Account → Account API Tokens is already scoped
to the single account you created it under — there’s no “All accounts” choice to make on this
path. Still scope the Zone Resources picker narrowly: the specific zone(s) you intend to
put in spec.zoneAllowlist, never “All zones”.
Scoping the token this way bounds what a leaked or misused token can reach, independent of
the in-cluster zoneAllowlist/namespaceSelector boundary described in
Credentials and Secrets.
cert-manager’s own token
Section titled “cert-manager’s own token”DNS Mode’s certificates are issued by cert-manager’s own Cloudflare DNS-01 ClusterIssuer,
which reads its own copy of the token (see
Credentials and Secrets). That token needs:
| Permission | Access level |
|---|---|
| Zone / DNS | Edit |
| Zone / Zone | Read |
DNS-01 validation works by creating and deleting a short-lived _acme-challenge TXT record,
which only needs Zone / DNS: Edit — but cert-manager’s own Cloudflare DNS-01 documentation
(cert-manager.io/docs/configuration/acme/dns01/cloudflare/) recommends Zone / DNS: Edit and
Zone / Zone: Read together, and lists a missing Zone / Zone: Read grant as one of two
possible causes of its zone.list permission error. Grant both, scoped to the same zone(s).