/k8s-cf-ns-sync

Simply sync NS record with k8s ingress resource annotion.

Primary LanguageGoMIT LicenseMIT

Intro

Simply sync DNS record from k8s ingress resource annotion to cloudflare.com.

Usage

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

Configuration

env vars:

  • LOG_LEVEL: running log level, should be DEBUG/INFO/WARN/ERROR

  • MONITOR_NS: monitoring k8s namespaces

  • CLOUDFLARE_API_TOKEN: cloudflare api_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

Ingress annotation

  • "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:
  # ...