How to install DNS with DevStack

The Designate source code contains a DevStack plugin that allows to deploy an OpenStack installation with the DNS service enabled.

Instructions

Note

If you want to use local sources for development then you should consider using the contrib/vagrant folder in the repository.

  1. Get a clean Ubuntu 20.04 VM (see the DevStack installation instructions for more details). DevStack “takes over”. Don’t use your desktop!

  1. Clone DevStack inside the VM

    $ git clone https://opendev.org/openstack/devstack.git
    
  2. Move to devstack directory

    $ cd devstack
    
  3. Create a local.conf config file

    [[local|localrc]]
    # General DevStack Config
    # =======================
    ADMIN_PASSWORD=password
    MYSQL_PASSWORD=password
    RABBIT_PASSWORD=password
    SERVICE_PASSWORD=password
    SERVICE_TOKEN=password
    
    # IP Address for services to bind to (Should match IP from Vagrantfile)
    SERVICE_HOST=192.168.27.100
    HOST_IP=$SERVICE_HOST
    
    # Logging
    #LOGFILE=/opt/stack/logs/stack.sh.log
    VERBOSE=True
    LOG_COLOR=True
    
    # Test a Gerrit Review
    # DESIGNATE_REPO=https://review.opendev.org/openstack/designate
    # DESIGNATE_BRANCH=refs/changes/41/765541/1
    
    # Test a particular branch
    # DESIGNATE_REPO=https://opendev.org/openstack/designate.git
    # DESIGNATE_BRANCH=stable/stein
    
    # Disable all services except core ones
    disable_all_services
    enable_service rabbit mysql key
    
    # Enable designate
    enable_plugin designate https://opendev.org/openstack/designate
    
    # Designate Devstack Config
    # =========================
    # Enable core Designate services
    enable_service designate,designate-central,designate-api,designate-worker,designate-producer,designate-mdns
    
    # Optional Designate services
    #enable_service designate-agent
    #enable_service designate-sink
    
    # Backend Driver (e.g. powerdns, bind9. See designate.backend section of
    #                 setup.cfg)
    #DESIGNATE_BACKEND_DRIVER=bind9
    
    # Agent Backend Driver (Used only when DESIGNATE_BACKEND_DRIVER=agent)
    #DESIGNATE_AGENT_BACKEND_DRIVER=fake
    
    # Pool Manager Cache Driver (e.g. noop, memcache, sqlalchemy. See
    #                            designate.backend section of setup.cfg)
    #DESIGNATE_POOL_MANAGER_CACHE_DRIVER=memcache
    
    # mDNS Service DNS Port Number
    #DESIGNATE_SERVICE_PORT_MDNS=5354
    
    # Designate Backend Config
    # ========================
    # DynECT Backend
    # NOTEs:
    # - DynECT requires DESIGNATE_SERVICE_PORT_MDNS is set to "53"
    # - DESIGNATE_DYNECT_MASTERS must be a Publicly reachable IP, pointed to mDNS
    #DESIGNATE_DYNECT_CUSTOMER=
    #DESIGNATE_DYNECT_USERNAME=
    #DESIGNATE_DYNECT_PASSWORD=
    #DESIGNATE_DYNECT_NAMESERVERS=ns1.p13.dynect.net,ns2.p13.dynect.net,ns3.p13.dynect.net,ns4.p13.dynect.net
    #DESIGNATE_DYNECT_MASTERS=
    
    # Akamai Backend
    #DESIGNATE_AKAMAI_USERNAME=
    #DESIGNATE_AKAMAI_PASSWORD=
    #DESIGNATE_AKAMAI_NAMESERVERS=a5-64.akam.net,a11-65.akam.net,a13-66.akam.net,a14-64.akam.net,a20-65.akam.net,a22-66.akam.net
    #DESIGNATE_AKAMAI_MASTERS=
    
    # Designate D2D Backend
    # NOTEs:
    # - DESIGNATE_D2D_ALSO_NOTIFIES needs to be set to the source mdns ip:port in
    #   order for designate to receive the proper NOTIFY
    # - DESIGNATE_D2D_* credentials should be setup either to the source keystone
    #   or the destination
    #DESIGNATE_D2D_MASTERS=
    #DESIGNATE_D2D_ALSO_NOTIFIES=
    #DESIGNATE_D2D_NAMESERVERS=
    
    # Authentication options
    #DESIGNATE_D2D_KS_VERSION=3
    
    #DESIGNATE_D2D_AUTH_URL=
    #DESIGNATE_D2D_USERNAME=
    #DESIGNATE_D2D_PASSWORD=
    
    # Keystone V2
    #DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_NAME:-}
    #DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_ID:-}
    
    # Keystone V3
    #DESIGNATE_D2D_PROJECT_NAME=
    #DESIGNATE_D2D_PROJECT_DOMAIN_NAME=
    #DESIGNATE_D2D_USER_DOMAIN_NAME=
    
    
    # Designate Misc Config
    # =====================
    
    # Enable a Notification Driver (e.g. for Ceiliometer)
    #DESIGNATE_NOTIFICATION_DRIVER=messaging
    
    # Set Notification topics
    #DESIGNATE_NOTIFICATION_TOPICS=notifications
    
    # Set coordination service URL (e.g. kazoo://localhost/)
    #DESIGNATE_COORDINATION_URL=
    
    
    # Other Devstack Config
    # =====================
    # Optional TLS Proxy
    #enable_service tls-proxy
    
    # Optional Tempest (Recommended)
    enable_service tempest
    
    # Optional Rally
    #enable_plugin rally https://opendev.org/openstack/rally.git master
    
    # Optional Horizon
    #enable_service horizon
    
    # Optional Glance
    #enable_service g-api
    
    # Optional Nova
    #enable_service n-api n-cpu n-net n-cond n-sch n-novnc
    
    # Optional Neutron
    #disable_service n-net
    #enable_service q-svc q-agt q-dhcp q-l3 q-meta
    
  4. Run DevStack

    $ ./stack.sh
    
  5. See the status of all Designate processes

    $ sudo systemctl status devstack@designate-*.service
    

    See the Using Systemd in DevStack home page for more options.

  1. Querying Logs

    $ sudo journalctl -f --unit devstack@designate-*.service
    

    See the Querying Logs home page for more options.

  1. Load credentials into the shell

    $ export OS_CLOUD=devstack-admin   # For the admin user, admin project
    $ export OS_CLOUD=devstack         # For the demo user, demo project
    
  2. Try out the openstack client

    $ openstack zone create --email admin@example.net example.net.
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | action         | CREATE                               |
    | attributes     |                                      |
    | created_at     | 2017-11-15T04:48:40.000000           |
    | description    | None                                 |
    | email          | admin@example.net                    |
    | id             | f34f835b-9acc-4930-b6dd-d045c15da78a |
    | masters        |                                      |
    | name           | example.net.                         |
    | pool_id        | 794ccc2c-d751-44fe-b57f-8894c9f5c842 |
    | project_id     | 9d0beaef253a4e14bd7025dc30c24f98     |
    | serial         | 1510721320                           |
    | status         | PENDING                              |
    | transferred_at | None                                 |
    | ttl            | 3600                                 |
    | type           | PRIMARY                              |
    | updated_at     | None                                 |
    | version        | 1                                    |
    +----------------+--------------------------------------+
    
    $ openstack recordset create --record '127.0.0.1'  --type A example.net. www
    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | action      | CREATE                               |
    | created_at  | 2017-11-15T04:51:27.000000           |
    | description | None                                 |
    | id          | 7861e600-8d9e-4e13-9ea2-9038a2719b41 |
    | name        | www.example.net.                     |
    | project_id  | 9d0beaef253a4e14bd7025dc30c24f98     |
    | records     | 127.0.0.1                            |
    | status      | PENDING                              |
    | ttl         | None                                 |
    | type        | A                                    |
    | updated_at  | None                                 |
    | version     | 1                                    |
    | zone_id     | f34f835b-9acc-4930-b6dd-d045c15da78a |
    | zone_name   | example.net.                         |
    +-------------+--------------------------------------+
    
    $ openstack recordset list f34f835b-9acc-4930-b6dd-d045c15da78a
    +--------------------------------------+------------------+------+---------------------------------------------------------------------+--------+--------+
    | id                                   | name             | type | records                                                             | status | action |
    +--------------------------------------+------------------+------+---------------------------------------------------------------------+--------+--------+
    | d0630d94-94d8-43fc-93e8-973fbec7531e | example.net.     | SOA  | ns1.devstack.org. admin.example.net. 1510721487 3510 600 86400 3600 | ACTIVE | NONE   |
    | 31a313dc-c322-4dc0-ba53-79c039d7f09f | example.net.     | NS   | ns1.devstack.org.                                                   | ACTIVE | NONE   |
    | 7861e600-8d9e-4e13-9ea2-9038a2719b41 | www.example.net. | A    | 127.0.0.1                                                           | ACTIVE | NONE   |
    +--------------------------------------+------------------+------+---------------------------------------------------------------------+--------+--------+
    
    $ openstack recordset show f34f835b-9acc-4930-b6dd-d045c15da78a 7861e600-8d9e-4e13-9ea2-9038a2719b41
    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | action      | NONE                                 |
    | created_at  | 2017-11-15T04:51:27.000000           |
    | description | None                                 |
    | id          | 7861e600-8d9e-4e13-9ea2-9038a2719b41 |
    | name        | www.example.net.                     |
    | project_id  | 9d0beaef253a4e14bd7025dc30c24f98     |
    | records     | 127.0.0.1                            |
    | status      | ACTIVE                               |
    | ttl         | None                                 |
    | type        | A                                    |
    | updated_at  | None                                 |
    | version     | 1                                    |
    | zone_id     | f34f835b-9acc-4930-b6dd-d045c15da78a |
    | zone_name   | example.net.                         |
    +-------------+--------------------------------------+
    
  3. Verify that the recordset is in DNS

    $ dig www.example.net @${SERVICE_HOST}
    
    ; <<>> DiG 9.16.1-Ubuntu <<>> www.example.net @192.168.27.100
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34315
    ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
    ;; WARNING: recursion requested but not available
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ; COOKIE: f10292dba9100bbf010000005f749e3586096307a693d0fe (good)
    ;; QUESTION SECTION:
    ;www.example.net.               IN      A
    
    ;; ANSWER SECTION:
    www.example.net.        3600    IN      A       127.0.0.1
    
    ;; Query time: 0 msec
    ;; SERVER: 192.168.27.100#53(192.168.27.100)
    ;; WHEN: Wed Sep 30 15:03:17 UTC 2020
    ;; MSG SIZE  rcvd: 88
    

    where SERVICE_HOST is the IP address used in local.conf.