Skip to content

A Python-based Kubernetes application that monitors Traefik IngressRoutes within Kubernetes to automatically create DNS records in your PowerDNS-Server.

Notifications You must be signed in to change notification settings

Tim-herbie/k8s_powerdns_traefik_sync

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn


Logo

PowerDNS Traefik Sync Tool for Kubernetes

A Python-based Kubernetes application that monitors Traefik IngressRoutes within Kubernetes to automatically create DNS records in your PowerDNS-Server.

· Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact
  6. Projects

About The Project

PowerDNS Deployment Architecture

Traefik PowerDNS Updater is a Python-based Kubernetes application designed to streamline DNS management. It monitors Traefik IngressRoutes within your Kubernetes cluster and automatically creates or updates DNS records in PowerDNS.

Components:

  • PTS Tool (PowerDNS Traefik Sync) Checks if Traefik ingressroutes were added or deleted and updates the PowerDNS via API
  • HA Postgres Database: Database of DNS records for the current state (by Postgres Zalando Operator)

(back to top)

Getting Started

The following requirements are necessary to install the project.

System requirements for installation

  • A running Kubernetes cluster
  • kubectl installed and configured
  • git installed and configured
  • jq installed
  • makefile installed

Already installed within your Kubernetes Cluster

  • Ingresscontroller Traefik
  • Zalando Postgres Operator (will be installed if not already done )

PowerDNS Version

The tool was tested with PowerDNS Authoritative Server 4.9.0.

PowerDNS Traefik Sync Tool Mode

The PowerDNS Traefik Sync Tool can be run with two different modes:

  • Normal: This is the simpler method, which uses the external IP of the Traefik service and points directly to that IP address (A-Record).
  • Advanced: The advanced mode requires the K8S_INGRESS variable, which directs all domains to the configured K8S_INGRESS domain using a CNAME record.

Usage

The deployment is handled by a Makefile. Please always use a released tag version instead of the unstable main branch!

Clone the repo

git clone https://github.com/Tim-herbie/k8s_powerdns_traefik_sync.git

Fill out variables

Before you can deploy it, you have at least to adjust the following Makefile variables:

Standard pts method:

  • PDNS_API_URL
  • DNS_ZONE
  • TRAEFIK_NAMESPACE (only necessary for the standard pts method)

Advanced pts method:

  • PDNS_API_URL
  • DNS_ZONE
  • K8S_INGRESS (only necessary for the advanced pts method)

Install the Makefile

make all

(back to top)

Documentation

PDNS Paramters

Parameter Default value Description
PDNS_API_URL https://pdns-auth.example.com/api/v1 The URL of your PowerDNS Server.
PDNS_API_KEY secret The Secret of your PowerDNS API. Fill it in the secret.yaml file
PDNS_ZONE_NAME example.com. The DNS Zoneof your PowerDNS Server, which you would like to create/update the dns records.
TTL 3600 The TTL of your dns records, which will be created.
CONTENT ingress.example.com. The DNS-Name of an existing dns record that point to your Kuberentes Ingress Gateway.

PTS Tool Paramters

Parameter Default value Description
PTS_MODE standard The mode of the PTS tool.
PTS_DOMAIN_LIST all Comma separated list of domains which should be handled with the PTS tool.
DEBUG_LOGGING false Debug Logging should only be activated for Troubleshooting, because it generates much Logs.
SLEEP_DURATION 45 The time interval for the loop to check if new Traefik Ingressroutes were created/deleted.
TRAEFIK_NAMESPACE traefik The Namespace where the application traefik is deployed.
TRAEFIK_CRD_GROUP traefik.io The CRD Group of Traefik.
TRAEFIK_CRD_VERSION v1alpha1 The CRD Version of Traefik
TRAEFIK_CRD_PLURAL ingressroutes The CRD PLURAL of Traefik

PSS Database Paramters

Parameter Default value Description
PTS_DB_NAME records The name of the PTS PSQL Database.
PTS_DB_USER postgres The username of the PTS PSQL Database.
PTS_DB_PASSWORD `` The password of the PTS PSQL Dtabase user.
PTS_DB_HOST pts-postgres-db The DNS name of the PTS PSQL Database.
PTS_DB_PORT 5432 The port of the PTS PSQL Database.

Debug Logs

If the DEBUG_LOGGING parameter in the deployment.yaml file is false, it will only log if a new Traefik Ingressroute was found or was not found anymore and deleted. If you are not sure that the tool is working fine, please change it to true.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

Tim Herbert - [email protected]

Project Link: https://github.com/Tim-herbie/k8s_powerdns_traefik_sync

(back to top)

Projects

Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!

(back to top)

About

A Python-based Kubernetes application that monitors Traefik IngressRoutes within Kubernetes to automatically create DNS records in your PowerDNS-Server.

Topics

Resources

Stars

Watchers

Forks