Crates.io | cloudflare-dns-operator |
lib.rs | cloudflare-dns-operator |
version | 0.1.8 |
source | src |
created_at | 2024-10-13 02:57:33.981133 |
updated_at | 2024-10-14 05:40:49.510898 |
description | Kubernetes operator to manage Cloudflare DNS records |
homepage | https://github.com/hypervideo/cloudflare-dns-operator |
repository | https://github.com/hypervideo/cloudflare-dns-operator |
max_upload_size | |
id | 1407039 |
size | 163,467 |
This is a kubernetes operator (custom resource definition + kubernetes controller) to manage cloudflare DNS entries from within kubernetes using the cloudflare API.
Note: This is an unofficial project and not affiliated in any way with cloudflare.
In your kubernetes cluster install the crds.yaml
file and a deployment matching
examples/deployment.yaml. Note that you'll need to set the env var
CLOUDFLARE_API_TOKEN
to a valid cloudflare API token.
This sets up the controller as a deployment. It'll watch for CloudflareDNSRecord
resources and
create/update/delete DNS records in cloudflare.
You can optionally have the controller check the records by doing DNS lookups from 1.1.1.1. The resolution result
will be reflected in the status.pending
field of the CloudflareDNSRecord
resource. For this to be enabled, set
the env var CHECK_DNS_RESOLUTION
to a human readable duration like 5m
or 1h
or 60s
.
You can then create a new DNS record like this:
apiVersion: dns.cloudflare.com/v1alpha1
kind: CloudflareDNSRecord
metadata:
name: my-cloudflare-dns-record
spec:
name: foo.example.com
type: A
ttl: 3600
content: "1.2.3.4"
zone:
name:
value: example.com
comment: "Managed by the Cloudflare DNS Operator"
tags:
- k8s
You can also automatically expose IPs from LoadBalancer services or external IP services by referencing a service in
the content
instead of a static IP:
# ...
content:
service:
name: traefik
namespace: traefik
# ...
The zone can also be set with a secret
or configMap
reference like this:
# ...
zone:
name:
from:
secret:
name: cloudflare-dns-secret
key: zone-name
# ...
See CloudflareDNSRecordSpec for more details.
License: MPL-2.0