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 657 forks source link

Document DNS binding rules/functions. #1243

Closed Freyert closed 6 years ago

Freyert commented 8 years ago

Perhaps, I just haven't found this in the documentation yet, but it seems like a very vital part of the BOSH deployer framework to be able to reference VMs with the DNS entry found on the bosh/microbosh director.

I have a lot of questions about the rules here. Mostly I have to deploy with a dynamic network set so it would be extremely helpful (actually vital) to be able to refer to each of my VMs by the host name registered in the director.

A few questions are:

I'd be glad to help add some documentation, but I don't really know that much. If anyone can point me in a good direction that would be great! Also, it seems like a good deal of this functionality would depend on the CPI itself?

allomov commented 8 years ago

Hey, @Freyert!

I also have not seen such docs, but I can address your questions.

1. What are the rules for name creation?

The short answer is that the DNS records for job instances are created in the following way:

<instance-index>.<job-name>.<network-name>.<deployment-name>.<bosh-dns-domain>

You set bosh-dns-domain in your deployment manifest with dns.domain_name option. Other options (such as instance index and name) are taken from instance model.

If you want to understand better how generating of DNS records works, you need to look into DnsManager implementation (link) in BOSH director. DNS name is built with DnsManager#dns_record_name method.

As a tip: you can run bosh vms --dns command to see what DNS records are created for your job/instances by BOSH.

2. What if I want multiple IPs?

Originally BOSH director create only one DNS record per instance. If you want to have multiple DNS records you'll need to write script to add it automatically or create it manually.

3. Can I select one IP to be "private"?

AFIK all DNS records, that are created by BOSH, work only for private network, so you can't access them from outside.

I hope it helped you! If I missed something or you have any further questions, you are welcome to ask them.

cppforlife commented 8 years ago

Small correction:

Originally BOSH director create only one DNS record per instance.

Director creates DNS record per instance-network pair.

@Freyert: I would also say that DNS is not necessary when working with BOSH (really depends on the support of static IPs by the IaaS). Now that we have links (http://bosh.io/docs/links.html), DNS records just like static IPs are not something operator should have to think too much about.

jiangytcn commented 8 years ago

@cppforlife we are using 3192 with microbosh, for now each job instance generated two dns records:

<instance-index>.<job-name>.<network-name>.<deployment-name>.<bosh-dns-domain> <UUID>.<network-name>.<deployment-name>.<bosh-dns-domain>

and can you tell me in which bosh version involved such UUID dns record, and why generate such record, is there any way to disable generating such dns record but only left <instance-index>.<job-name>.XXXX. thank you so much :)

dpb587-pivotal commented 8 years ago

UUIDs were added around v244 as part of the efforts to make deployments availability zone-aware. There's no configuration option to disable UUID's and you should try to move away from the indices in favor of UUIDs.

With AZ-aware instances, index-based instances could result in gaps and confusion, so UUIDs were added and are now the preferred method of referencing VMs.

mfine30 commented 6 years ago

Seems like there haven't been any follow up questions on this for a while. Additionally, there is now http://bosh.io/docs/dns. If you still have questions, feel free to reopen or open a new issue.