Skip to content

Commit 967a5db

Browse files
committed
doc(configuring-dns): Rewrite DNS docs for brevity and correctness
1 parent be6a673 commit 967a5db

2 files changed

Lines changed: 44 additions & 40 deletions

File tree

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,64 @@
11
# Configure DNS
22

3-
For Deis clusters, DNS records must be created. The Deis cluster runs multiple routers infront of the Deis controller and apps you deploy, so a [load balancer][] is recommended.
3+
The Deis Workflow controller and all applications deployed via Workflow are intended (by default) to be accessible as subdomains of the Workflow cluster's domain. For example, assuming `example.com` were a cluster's domain:
44

5-
You can find the IP addresses of your Kubernetes cluster nodes by
6-
running `kubectl get nodes`.
5+
* The controller should be accessible at `deis.example.com`
6+
* Applications should be accessible (by default) at `<application name>.example.com`
77

8-
## Necessary DNS records
8+
Given that this is the case, the primary objective in configuring DNS is that traffic for all subdomains of a cluster's domain be directed to the cluster node(s) hosting the platform's router component, which is capable of directing traffic within the cluster to the correct endpoints.
99

10-
Deis requires a wildcard DNS record. Assuming `myapps.com` is the top-level domain
11-
apps will live under:
1210

13-
* `*.myapps.com` should have "A" record entries for each of the load balancer's IP addresses
11+
## With a Load Balancer
1412

15-
Apps can then be accessed by browsers at `appname.myapps.com`, and the controller will be available to the Deis client at `deis.myapps.com`.
13+
Generally, it is recommended that a [load balancer][] be used to direct inbound traffic to one or more routers. In such a case, configuring DNS is as simple as defining a wildcard record in DNS that points to the load balancer.
1614

17-
[AWS recommends][] against creating "A" record entries; instead, create a wildcard "CNAME" record entry for the load balancer's DNS name, or use Amazon [Route 53][].
15+
For example, assuming a domain of `example.com`:
1816

19-
These records are necessary for all deployments of Deis other than Vagrant clusters.
17+
* An `A` record enumerating each of your load balancer(s) IPs (i.e. DNS round-robining)
18+
* A `CNAME` record referencing an existing fully-qualified domain name for the load balancer
19+
* Per [AWS' own documentation][AWS recommends], this is the recommended strategy when using AWS Elastic Load Balancers, as ELB IPs may change over time.
2020

21-
## DNS without a Load Balancer
21+
DNS for any applications using a "custom domain" (a fully-qualified domain name that is not a subdomain of the cluster's own domain) can be configured by creating a `CNAME` record that references the wildcard record described above.
2222

23-
On some platforms (Vagrant, for instance), a load balancer is not an easy or practical thing to
24-
provision. In these cases, one can directly identify the public IP of a Kubernetes node that is
25-
hosting a router pod and use that information to configure DNS or the local `/etc/hosts` file.
26-
27-
You can find the IP address of a node using `kubectl`:
23+
Although it is dependent upon your distribution of Kubernetes and your underlying infrastructure, in many cases, the IP(s) or existing fully-qualified domain name of a load balancer can be determined directly using the `kubectl` tool:
2824

2925
```
30-
$ kubectl get pods --namespace=deis | grep deis-router
31-
deis-router-ih25q 1/1 Running 0 2h
26+
$ kubectl describe service deis-router --namespace=deis | grep "LoadBalancer Ingress"
27+
LoadBalancer Ingress: a493e4e58ea0511e5bb390686bc85da3-1558404688.us-west-2.elb.amazonaws.com
3228
```
3329

34-
Using the pod name determined through the above, one can
35-
use `kubectl` to determine what node the pod is running on:
30+
The `LoadBalancer Ingress` field typically describes an existing domain name or public IP(s). Note that if Kubernetes is able to automatically provision a load balancer for you, it does so asynchronously. If the command shown above is issued very soon after Workflow installation, the load balancer may not exist yet.
3631

37-
```
38-
$ kubectl describe pod deis-router-ih25q --namespace=deis
39-
```
4032

41-
The `Node` field of the response should provide an IP:
33+
## Without a Load Balancer
4234

43-
```
44-
Node: 10.245.1.3/
45-
```
35+
On some platforms (Vagrant, for instance), a load balancer is not an easy or practical thing to provision. In these cases, one can directly identify the public IP of a Kubernetes node that is hosting a router pod and use that information to configure the local `/etc/hosts` file.
36+
37+
Because wildcard entries do not work in a local `/etc/hosts` file, using this strategy may result in frequent editing of that file to add fully-qualified subdomains of a cluster for each application added to that cluster. Because of this a more viable option may be to utilize the [xip.io][xip] service.
4638

47-
If the IP is public, this can be used to configure DNS or the
48-
local `/etc/hosts` file.
39+
In general, for any IP, `a.b.c.d`, the fully-qualified domain name `any-subdomain.a.b.c.d.xip.io` will resolve to the IP `a.b.c.d`. This can be enormously useful.
4940

50-
An easy way to configure wildcard DNS is to use [xip.io][] to reference the IP of the node running
51-
your router. For example:
41+
To begin, find the node(s) hosting router instances using `kubectl`:
5242

53-
$ deis register http://deis.10.245.1.3.xip.io
43+
```
44+
$ kubectl describe pod deis-router --namespace=deis | grep Node
45+
Node: ip-10-0-0-199.us-west-2.compute.internal/10.0.0.199
46+
Node: ip-10-0-0-198.us-west-2.compute.internal/10.0.0.198
47+
```
5448

55-
Note that xip does not seem to work for AWS ELBs - you will have to use an actual DNS record.
49+
The command will display information for every router pod. For each, a node name and IP are displayed in the `Node` field. If the IPs appearing in these fields are public, any of these may be used to configure your local `/etc/hosts` file or may be used with [xip.io][xip]. If the IPs shown are not public, further investigation may be needed.
5650

57-
Alternatively, in your `/etc/hosts` file, add an entry like this:
51+
You can list the IP addresses of a node using `kubectl`:
5852

5953
```
60-
10.245.1.3 example.com deis.example.com
54+
$ kubectl describe node ip-10-0-0-199.us-west-2.compute.internal
55+
# ...
56+
Addresses: 10.0.0.199,10.0.0.199,54.218.85.175
57+
# ...
6158
```
6259

63-
This will get you started, though you may find that you have to manually maintain this file as you
64-
create and deploy more applications to the cluster.
60+
Here, the `Addresses` field lists all the node's IPs. If any of them are public, again, they may be used to configure your local `/etc/hosts` file or may be used with [xip.io][xip].
61+
6562

6663
## Testing
6764

@@ -72,14 +69,19 @@ sent to the Deis controller like so (do not forget the trailing slash!):
7269
curl http://deis.example.com/v2/
7370
```
7471

75-
Since such requests require authentication, a response such as
76-
the following is an indicator of success:
72+
Or:
73+
74+
```
75+
curl http://deis.54.218.85.175.xip.io/v2/
76+
```
77+
78+
79+
Since such requests require authentication, a response such as the following should be considered an indicator of success:
7780

7881
```
7982
{"detail":"Authentication credentials were not provided."}
8083
```
8184

8285
[AWS recommends]: https://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-domain-names-with-elb.html
8386
[load balancer]: configuring-load-balancers.md
84-
[Route 53]: http://aws.amazon.com/route53/
8587
[xip]: http://xip.io/

src/managing-workflow/configuring-load-balancers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ These ports need to be open on the load balancers:
1111
If you want to configure SSL termination on your load balancer, see [Platform SSL](platform-ssl.md).
1212

1313
A health check should be configured on the load balancer to send an HTTP request to /healthz at port 9090 on all nodes in the Deis cluster. The health check endpoint returns an HTTP 200. This enables the load balancer to serve traffic to whichever hosts happen to be running the router component at any moment.
14+
15+
See [the router component's own documentation](https://github.com/deis/router#front-facing-load-balancer) for further details.

0 commit comments

Comments
 (0)