Public DNS resolve for VM instances hosted at OpenStack nova compute grizzly edition
Issue – the OpenStack instances hostnames are not resolved at the moment by their floating IPs.
Fast solution – use PowerDNS
1. Boot an instance , assign it a floating IP, open tcp ports 22 8001 and udp port 53.
2. Install PowerDNS, the particular yum package is named pdns.
3. install the mysql backend for PowerDNS, its available as yum package as well.
4. Install MariaDB , set the proper configuration, the initialize it at the default location.
5. Set the pdns user, create the pdns database and create the tables needed.
6. Configure the pdns service to use the gmysql backend.
7. Create and user at the OpenStack MySQL able to connect from the floating IP subnet.
8. Grant that user select permissions on all nova.* tables.
9. At the PowerDNS instance, set simple python / php / bash script to query the nova database and to inject the hostnames and the floating IPs as DNS records for the particular OpenStack domains at the pdns db at the pdns OpenStack instance.
In fact, what I do is to clean up all the available OpenStack DNS records, and to inject them again in one transaction, in a view to clean up the deleted and changed hostnames / floating IPs.
10. Set up the external DNS server to forward all queries related to the OpenStack domains to the PowerDNS floating UP.
In general, its good to start a python daemon, in a view to keep the recent status of the OpenStack DNS as a simple hash,
and only when there are changes in OpenStack instances / assigned floating IPs, to push the updates to the RowerDNS db backend.
I hate when the database is used in a lazy way.
All that can be done by hacking the nova python code, as PowerDNS has restful API as well,
but I know there are incoming new OpenStack modules which will do that.
The long story with examples and links TBD.
Update : the source code is here : https://github.com/seikath/openstack-external-dns
One more update to be pushed to the git source:
In a view to push the VM hostname changes without recreating the VM, I decided to use short_description field instead of the hostname,
as the nova rename instance command changes only that field, and the hostname remains intact.
The production code is changed and tested, just not pushed to the public repo.