cloudfoundry / bosh

Cloud Foundry BOSH is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services.
https://bosh.io
Apache License 2.0
2.03k stars 658 forks source link

bosh vms --dns return two dns name for a vm #1439

Closed chrisrana closed 8 years ago

chrisrana commented 8 years ago

I am using bosh-init,bosh-257.9.tgz and cf-233 .Stemcell 3262.2

DNS host name is not resolving while deploying cloud foundry.On exploring I get two entry for cloud controller and other vm in powerdns db postgres.

95a07d80-3fb8-40db-8a13-3c295755b066.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh 0.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh

In horizone

95a07d80-3fb8-40db-8a13-3c295755b066 is not VM instance ID ,but it is present in metdata section of of the VM NAME cloud_controller/95a07d80-3fb8-40db-8a13-3c295755b066 DEPLOYMENT cf-installer-team-test ID 95a07d80-3fb8-40db-8a13-3c295755b066

image

These two host name is not pingable in director and in respective also. 0.consul.ccc-bosh-net.cf-installer-team-test.microbosh 0.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh

bosh vms --dns

| cloud_controller/0 | starting | large | 10.20.0.231 | 95a07d80-3fb8-40db-8a13-3c295755b066.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh | | | | | | 0.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh |

| consul/0 | running | small | 10.20.0.232 | 48d2b0a4-8533-4b7d-a3c5-b11ab463e910.consul.ccc-bosh-net.cf-installer-team-test.microbosh | | | | | | 0.consul.ccc-bosh-net.cf-installer-team-test.microbosh

powerdns entry in postgres DB.

4 | 0.consul.ccc-bosh-net.cf-installer-team-test.microbosh | A | 10.20.0.232

5 | 0.20.10.in-addr.arpa | SOA | localhost hostmaster@localhost 0 10800 604800 30

6 | 0.20.10.in-addr.arpa | NS | ns.microbosh

7 | 232.0.20.10.in-addr.arpa | PTR | 0.consul.ccc-bosh-net.cf-installer-team-test.microbosh

8 | 48d2b0a4-8533-4b7d-a3c5-b11ab463e910.consul.ccc-bosh-net.cf-installer-team-test.microbosh | A | 10.20.0.232

9 | 232.0.20.10.in-addr.arpa | PTR | 48d2b0a4-8533-4b7d-a3c5-b11ab463e910.consul.ccc-bosh-net.cf-installer-team-test.mi crobosh

**10 | 0.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh | A | 10.20.0.231

11 | 231.0.20.10.in-addr.arpa | PTR | 0.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh

12 | 95a07d80-3fb8-40db-8a13-3c295755b066.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh | A | 10.20.0.231

13 | 231.0.20.10.in-addr.arpa | PTR | 95a07d80-3fb8-40db-8a13-3c295755b066.cloud-controller.ccc-bosh-net.cf-installer-te** am-test.microbosh 1 | microbosh | SOA | localhost hostmaster@localhost 0 10800 604800 30 2 | microbosh | NS | ns.microbosh 3 | ns.microbosh | A |


bosh-init.yml

`<% load 'bosh-init/bosh-init.rb' %>

name: <%= $os_tenant %>

releases:

resource_pools:

disk_pools:

networks:

jobs:

cloud_provider: template: {name: openstack_cpi, release: bosh-openstack-cpi}

ssh_tunnel: host: <%=$bosh_director_ip %> # <--- Replace with a floating IP port: 22 user: vcap private_key: <%= $key_file %> # Path relative to this manifest file

mbus: "https://mbus:mbus-password@<%=$bosh_director_ip %>:6868" # <--- Replace with a floating IP

properties: openstack: openstack agent: {mbus: "https://mbus:mbus-password@0.0.0.0:6868"} blobstore: {provider: local, path: /var/vcap/micro_bosh/data/cache} ntp: ntp `

tylerschultz commented 8 years ago

What are the dns addresses specified in the network subnet for the deployed cf instances? It needs to include the director's ip address.

chrisrana commented 8 years ago

I didnt get you .Just to inform you same cf 233 works fine with microbosh. I am facing this issue in bosh-init.But problem here is why we have two host entry is mapped with single IP in postgres DB for a vm instance.I having feeling that because of this host name is not resolving.PLease refer image pasted there it show bosh vms output

tylerschultz commented 8 years ago

The 2 dns entries are expected behavior. One address is the index based address. The other address is the instance uuid based address. The index is something that we'd like to eventually hide away and not expose, as a long term goal. Can you explain why you think having 2 DNS entries is a problem?

What is the contents of /etc/resolv.conf in one of the deployed vms? Does it contain the director's ip address?

What happens when you run dig @<director-ip-address> 48d2b0a4-8533-4b7d-a3c5-b11ab463e910.consul.ccc-bosh-net.cf-installer-team-test.microbosh from inside one of the deployed vms?

The cf manifest should have a networks section that the jobs reference. There is likely a dns key/value on each subnet. What is the value seen there?

chrisrana commented 8 years ago

I was not aware about 2dns entries thanks for info. I checked /etc/resolv.conf It doesnot contain bosh director IP.

dig b1577113-6e2b-4830-8d96-4f7e58bbd092.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> b1577113-6e2b-4830-8d96-4f7e58bbd092.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 60084
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;b1577113-6e2b-4830-8d96-4f7e58bbd092.cloud-controller.ccc-bosh-net.cf-installer-team-test.microbosh. IN        A

;; AUTHORITY SECTION:
.                       1797    IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2016091400 1800 900 604800 86400

;; Query time: 17 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Sep 14 18:24:56 UTC 2016
;; MSG SIZE  rcvd: 203

dig director_ip

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> 10.20.0.55
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15502
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;10.20.0.55.                    IN      A

;; ANSWER SECTION:
10.20.0.55.             0       IN      A       10.20.0.55

;; Query time: 0 msec
;; SERVER: 10.20.0.2#53(10.20.0.2)
;; WHEN: Wed Sep 14 18:25:08 UTC 2016
;; MSG SIZE  rcvd: 44

cf-template Job is referring following setting for networks

networks:
 - name: ccc-bosh-net
   type: dynamic
   cloud_properties:
      net_id: <%= $bosh_net_id %>
      security_groups:
        - <%= $new_securitygroup %>

......
...
jobs:
- instances: 1
  name: cloud_controller
  networks:
  - name: ccc-bosh-net
  persistent_disk: 20000
tylerschultz commented 8 years ago

I think I see the problem. I followed the code through and it automatically adds the power dns server address to the configuration on each instance. I see that your dns.address is 127.0.0.1. This should be <%= $bosh_director_ip %> .

chrisrana commented 8 years ago

Thanks tylers. It worked like a charm.