Setup required to test DnsSwitch functionality
1. Place dnsSwitch.bash on core-dns master under /home/ubuntu
2. Place sdnc.dnsswitch and site.conf on respective sites under /home/ubuntu
3. Make sure that site.conf is properly configured on site-A and site-B
e.g. as follows- a) for site A siteIP="10.147.112.139" ----- IP Addresss of Site A app="sdnc" --- app name is sdnc corednsHost="10.147.114.7" ----- IP address of core-dns master b) for site B siteIP="10.147.113.136" ----- IP Addresss of Site B app="sdnc" --- app name is sdnc corednsHost="10.147.114.7" ----- IP address of core-dns master
4. Following are the steps to create core-dns ssh connection with sites
a. Execute below command /home/ubuntu on coredns master (make sure to use the key name as coredns.key) : ssh-keygen -t rsa -f coredns.key - This creates two files- coredns.key and coredns.key.pub under /home/ubuntu b. Copy above two key files on site A and site B and execute below command. sudo ssh-copy-id -i coredns.key root@<corednsHost> c. verify below command works for root user without any prompts(because the key was added with root user): ssh -i /home/ubuntu/coredns.key root@<corednsHost>
5. You may verify the logs on core-dns masterĀ
root@core-dns-master:~$ ll *.log -rw-r--r-- 1 root root 12002 May 1 11:28 dnsSwitch.log root@core-dns-master:~$ root@core-dns-master:~$ cat dnsSwitch.log Fri Apr 27 09:16:10 EDT 2018 script called from site: 10.147.113.136 Fri Apr 27 09:16:10 EDT 2018 logging current dns entry Server: 10.96.0.10 Address: 10.96.0.10#53 Name: sdnc.example.com Address: 10.147.112.139 Fri Apr 27 09:16:10 EDT 2018 editing dns zone Fri Apr 27 09:16:10 EDT 2018 verify if dns domain address exist in configuration for given app: sdnc Fri Apr 27 09:16:10 EDT 2018 dns domain address was found Fri Apr 27 09:16:10 EDT 2018 dns zone file edited Fri Apr 27 09:16:10 EDT 2018 editing coredns configmap configmap "coredns" deleted configmap "coredns" created Fri Apr 27 09:16:11 EDT 2018 coredns configmap edited Fri Apr 27 09:16:11 EDT 2018 waiting for dns cache time Fri Apr 27 09:17:01 EDT 2018 sending refresh signal for coredns configmap Fri Apr 27 09:17:01 EDT 2018 Completed executing sdnc.dnsswitch on host: core-dns-master