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
Code Block |
---|
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 ssh key for remote core-dns connection
Code Block |
---|
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. Make sure kubectl works on core-dns master
Code Block |
---|
#kubernetes cluster was installed using ubuntu, hence below does not work
root@core-dns-master:/home/ubuntu# kubectl get pods -n onap
The connection to the server localhost:8080 was refused - did you specify the right host or port?
#copy kube config using root user to /root to make it work
root@core-dns-master:/home/ubuntu# cp /home/ubuntu/.kube/ /root
#verify kubectl works from root user
root@core-dns-master:~# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-7fd6694686-dnwt7 1/1 Running 2 11d
kube-system coredns-7fd6694686-jrj92 1/1 Running 2 11d
kube-system etcd-core-dns-master 1/1 Running 2 12d
kube-system kube-apiserver-core-dns-master 1/1 Running 10 12d
kube-system kube-controller-manager-core-dns-master 1/1 Running 8 12d
kube-system kube-proxy-j4wlv 1/1 Running 2 12d
kube-system kube-proxy-q74fc 1/1 Running 2 12d
kube-system kube-scheduler-core-dns-master 1/1 Running 7 12d
kube-system tiller-deploy-84f4c8bb78-skvlp 1/1 Running 2 12d
kube-system weave-net-lq4ls 2/2 Running 7 12d
kube-system weave-net-rm6z4 2/2 Running 15 12d
|
6. Execute sdnc.dnsswitch script from Site A or Site B
Code Block |
---|
root@k8s-master:/home/ubuntu# ./sdnc.dnsswitch
Note :- execute sdnc.dnsswitch as root |
7. You may verify the logs on core-dns master :
Code Block |
---|
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
|