Simply sync DNS record from k8s ingress resource annotion to cloudflare.com
.
Deploy the image to your cluster, and give it authorization to "get/list/watch" your ingress resources in the target namespaces.
image: ghcr.io/das6ng/k8s-cf-ns-sync:latest
deploy example: link
env vars:
-
LOG_LEVEL
: running log level, should beDEBUG/INFO/WARN/ERROR
-
MONITOR_NS
: monitoring k8s namespaces -
CLOUDFLARE_API_TOKEN
: cloudflareapi_token
The api token MUST have the following
Permissions
on your target zone:Zone DNS Read Zone DNS Edit
-
CLOUDFLARE_ZONE_NAME
: cloudflare managed DNS name
-
"cf-ns-sync/name"
: DNS A record name -
"cf-ns-sync/value"
: DNS A record content
Example:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-ingress
annotations:
"cf-ns-sync/name": test01.abc.com
"cf-ns-sync/value": 191.168.1.99
spec:
rules:
# ...