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
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)
The following requirements are necessary to install the project.
- A running Kubernetes cluster
- kubectl installed and configured
- git installed and configured
- jq installed
- makefile installed
- Ingresscontroller Traefik
- Zalando Postgres Operator (will be installed if not already done )
The tool was tested with PowerDNS Authoritative Server 4.9.0.
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.
The deployment is handled by a Makefile. Please always use a released tag version instead of the unstable main branch!
git clone https://github.com/Tim-herbie/k8s_powerdns_traefik_sync.git
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)
make all
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. |
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 |
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. |
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
.
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Tim Herbert - [email protected]
Project Link: https://github.com/Tim-herbie/k8s_powerdns_traefik_sync
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!