Skip to content

MySocialApp/k8s-dns-updater

Repository files navigation

k8s-dns-updater Build Status Docker Repository on Quay

Kubernetes DNS updater is a tool watching Kubernetes nodes status changes and update the Round Robin DNS accordingly. This is useful when running an on premise cluster with a simple DNS load balancing. This to avoid manual intervention when a node fails down or is going into maintenance.

test

We've made this application at MySocialApp in order to have automatic changes to:

  • Add a node in the round robin DNS when a node is uncordoned
  • Remove a node from the round robin DNS when a node is drained

Usage

Simply copy the binary and the example configuration file config.yaml.example to config.yaml. Then update the configuration with your information:

GlobalConfig:
  # Use node name (node) or dns name (dns) IP to update DNS
  UpdateDNSType: node
  # Wanted entries in the Round Robin DNS
  WantedRrDNSEntries: 3

# DNS info
DNSInfos:
  Name: "my-round-robin.domain.com"
  Type: A
  TTL: 120
  Proxied: false

# Credentials
CloudFlareAPIInfos:
  Zoneid: ""
  Zonename: ""
  Email: ""
  Key: ""

Then launch the binary in the same folder than the configuration file.

Kubernetes (HELM)

You can deploy it with the provided HELM chart. First update the values.yaml file:

KduImageVersion: v0.3
#KduNodeSelector:
#  node-role.kubernetes.io/node: "true"
KduRbacEnabled: true

# Global Config
KduGlobalUpdateType: node
KduGlobalMaxDnsEntries: 10

# DNS Info
KduInfosName: "your_rr_record"
KduInfosType: A
KduInfosTtl: 120
KduInfosProxied: false

# Cloudflare API
KduCfZoneId: "your_id"
KduCfZoneName: "your-domain.com"
KduCfEmail: "your_mail"
KduCfKey: "your_key"

Then deploy it into your cluster:

helm install --values kubernetes/values.yaml kubernetes

Limitations

  • Support only CloudFlare provider

Todo

  • Support a limited number of DNS entries in RR (in progress)
  • When booting, validate the current status and update accordingly the DNS (in progress)
  • Add Ingress support and detect ingress readiness before adding back in RR
  • Add Ingress support and detect if an ingress readiness is failing to remove from RR
  • Add prometheus metrics