This repository contains a working configuration for PowerDNS setup on Kubernetes with Mysql backend. MariaDB galera cluster is used as backend.
We use severalnines setup of MariaDB Galera cluster: https://github.com/severalnines/galera-docker-mariadb/tree/master/example-kubernetes
Only Development Version:
This installation is Tested only on a minikube cluster.
So, it can only be used in development environment.
It requires following steps (not exhaustive) to reach a production state:
- Testing on a multi-node cluster
- Add https support
- Add secrets for credentials stored in plaintext
Tools Installed and Access:
PowerDNS
: A deployment for PowerDNS service (API disabled). Served on<minikube_node_ip>:30053
PowerDNS API
: A deployment for PowerDNS API service. Served onpdns-api.minikube:80
PowerDNS Admin
: A deployment for PowerDNS Admin GUI. Served onpdns-admin.minikube:80
Nginx Ingress
: Ingress controller to expose the PowerDNS API and PowerDNS Admin on httpMariadb 10.1 Galera
: A MariaDB galera cluster from severalnines
Directory structure:
nginx-ingress-controller
: Contains k8s configuration files for nginx-ingress-controllerpdns/galera
: Contains configuration files to setup a Galera clusterpdns
: Contains configuration files to setup PDNS server, PDNS API server and PDNS-Admin server
Installation Steps:
- Install minikube on local and start a cluster: https://kubernetes.io/docs/tasks/tools/install-minikube/
- Add
/etc/hosts
entry to <minikube_node_ip
> for following domains:pdns.minikube
pdns-api.minikube
pdns-admin.minikube
- Install nginx-ingress-controller in "ingress-nginx" namespace:
- Create Controller:
kubectl apply -f nginx-ingress-controller/
- Create Ingress Rules:
kubectl apply -f pdns/pdns_nginx_ingress.yaml
- Create Controller:
- Install Mariadb 10.1 Galera cluster in "galera_cluster" namespace:
- Create Namespace:
kubectl apply -f pdns/galera/galera_namespace.yaml
- Create etcd cluster for galera:
kubectl apply -f pdns/galera/galera_etcd.yaml
- Change replica to 1 in Deployment in file
pdns/galera/galera_mariadb.yaml
- Deploy 1 node galera cluster:
kubectl apply -f pdns/galera/galera_mariadb.yaml
- Change replica to 3 in Deployment in file
pdns/galera/galera_mariadb.yaml
- Scale the cluster to size 3:
kubectl apply -f pdns/galera/galera_mariadb.yaml
- Create Namespace:
- Install pdns in "default" namespace:
- Create Config map for pdns:
kubectl create configmap pdns-conf --from-file=pdns.conf=pdns.conf
- Deploy the pdns:
kubectl apply -f pdns/pdns_deployment.yaml
- Create SSH tunnel to access mysql on local mysql client:
ssh -i ~/.minikube/machines/minikube/id_rsa -NfL 5000:<galera_db_service_ip>:3306 docker@<minikube_node_ip>
- Install pdns schema in mysql
mysql -h 127.0.0.1 -P 5000 -u pdns -p pdns < pdns/pdns_schema.sql
- Access webserver on
pdns.minikube
- Access DNS on
pdns.minikube:30053
- Create Config map for pdns:
- Install pdns-api in "default" namespace:
- Create Config map for pdns-api:
kubectl create configmap pdns-api-conf --from-file=pdns-api.conf=pdns-api.conf
- Deploy the pdns-api:
kubectl apply -f pdns/pdns_api_deployment.yaml
- Access API on
pdns-api.minikube:80
- Create Config map for pdns-api:
- Install PowerDNS Admin GUI in "default" namespace:
- Login to Mysql as "root" user. Create database with name
powerdns_admin
and provide all privileges to "pdns" user - Create Config map:
kubectl create configmap pdns-admin-conf --from-file=config.py=pdns_admin_config.py
- Deploy the GUI:
kubectl apply -f pdns/pdns_admin_deployment.yaml
- Access GUI on
pdns-admin.minikube:80
- Login to Mysql as "root" user. Create database with name