How to add customer DNS records via BOSH DNS aliases
search cancel

How to add customer DNS records via BOSH DNS aliases

book

Article ID: 298060

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

Listed below are some scenarios you could consider using this workaround:
  1. The application team wants to add some DNS records for testing while they have not yet got approval to change in their external DNS servers (configured in BOSH tile).
  2. There is an issue in the customer networking layer, typically the Load Balancer (LB), which could cause app-to-app communication errors if the route is through LB. To troubleshoot this issue, you can try bypass LB by resolving destination app's route to Gorouter IP.
Note: After testing, you should remove this workaround and continue with the permanent change in external DNS servers.


Environment

Product Version: 2.8

Resolution

The BOSH DNS job running in each Diego Cell respects aliases configuration in the following folders:
$ cat /var/vcap/jobs/bosh-dns/config/config.json | json_pp | grep alias_files_glob
   "alias_files_glob" : "/var/vcap/jobs/*/dns/aliases.json",

For more information on the syntax of aliases.json, refer to the following documentation: https://bosh.io/docs/dns/#example

For example:
## resolving external services
{ "svc1.xxx.com":["10.193.78.10"],
  "svc2.xxx.com":["10.193.78.20"]
}

## bypassing LB
{ "app.CF_APP-DOMAIN":["<Gorouter IP>"]
}


Option-A: Include your customer DNS records into each Diego Cell

  1. Create the file aliases.json which contains the DNS records you need. Copy it to each Diego Cell using bosh scp.
    bosh -d cf-xxx scp ./aliases.json diego-cell:/tmp/aliases.json
  2. Make your aliases effective in each Diego Cell.
    bosh -d cf-xxx ssh diego_cell -c​ 'sudo mkdir -p /var/vcap/jobs/my-aliases/dns/; sudo cp /tmp/aliases.json /var/vcap/jobs/my-aliases/dns/; sudo /var/vcap/bosh/bin/monit restart bosh-dns'
  3. Remove the aliases after you complete the testing.
    bosh -d cf-xxx ssh diego_cell -c​ 'cd /var/vcap/jobs/; sudo rm -r my-aliases/; sudo /var/vcap/bosh/bin/monit restart bosh-dns'


Option-B: Include your customer DNS records into specific Diego Cells

  1. For the application which requires these DNS records, identify the Diego Cells which host application containers. 
    cf curl /v2/apps/$(cf app --guid APP-NAME)/stats | grep host
  2. Use similar steps as in Option-A but specify the Diego Cell instance name. For example:
    bosh -d cf-xxx scp ./aliases.json diego-cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0:/tmp/aliases.json
    
    bosh -d cf-xxx ssh diego_cell/209c42e5-3c1a-432a-8445-ab8d7c9f69b0 <...>

Warning: Please note that changing BOSH DNS entries on a Cell will apply those changes to all applications running on the Cell, not just a single application.