initial-design.md 4.77 KB
Newer Older
ideahitme's avatar
ideahitme committed
1
2
3
4
5
6
7
8
# Proposal: Design of External DNS

## Background

[Project proposal](https://groups.google.com/forum/#!searchin/kubernetes-dev/external$20dns%7Csort:relevance/kubernetes-dev/2wGQUB0fUuE/9OXz01i2BgAJ)

[Initial discussion](https://docs.google.com/document/d/1ML_q3OppUtQKXan6Q42xIq2jelSoIivuXI8zExbc6ec/edit#heading=h.1pgkuagjhm4p)

9
This document describes the initial design proposal.
ideahitme's avatar
ideahitme committed
10
11
12

External DNS is purposed to fill the existing gap of creating DNS records for Kubernetes resources. While there exist alternative solutions, this project is meant to be a standard way of managing DNS records for Kubernetes. The current project is a fusion of the following projects and driven by its maintainers:

13
1. [Kops DNS Controller](https://github.com/kubernetes/kops/tree/HEAD/dns-controller)
14
2. [Mate](https://github.com/linki/mate)
ideahitme's avatar
ideahitme committed
15
16
17
18
19
20
21
22
23
24
25
26
27
3. [wearemolecule/route53-kubernetes](https://github.com/wearemolecule/route53-kubernetes)

## Example use case:

User runs `kubectl create -f ingress.yaml`, this will create an ingress as normal.
Typically the user would then have to manually create a DNS record pointing the ingress endpoint
If the external-dns controller is running on the cluster, it could automatically configure the DNS records instead, by observing the host attribute in the ingress object.

## Goals

1. Support AWS Route53 and Google Cloud DNS providers
2. DNS for Kubernetes services(type=Loadbalancer) and Ingress
3. Create/update/remove records as according to Kubernetes resources state
ideahitme's avatar
ideahitme committed
28
4. It should address main requirements and support main features of the projects mentioned above
ideahitme's avatar
ideahitme committed
29

30
## Design
ideahitme's avatar
ideahitme committed
31
32
33
34
35

### Extensibility

New cloud providers should be easily pluggable. Initially only AWS/Google platforms are supported. However, in the future we are planning to incorporate CoreDNS and Azure DNS as possible DNS providers

36
37
38
39
### Configuration

DNS records will be automatically created in multiple situations:
1. Setting `spec.rules.host` on an ingress object.
40
41
42
2. Setting `spec.tls.hosts` on an ingress object.
3. Adding the annotation `external-dns.alpha.kubernetes.io/hostname` on an ingress object.
4. Adding the annotation `external-dns.alpha.kubernetes.io/hostname` on a `type=LoadBalancer` service object.
43

ideahitme's avatar
ideahitme committed
44
45
### Annotations

46
Record configuration should occur via resource annotations. Supported annotations:
ideahitme's avatar
ideahitme committed
47

ideahitme's avatar
ideahitme committed
48
|   Annotations |   |
ideahitme's avatar
ideahitme committed
49
|---|---|
50
|Tag   |external-dns.alpha.kubernetes.io/controller   |
ideahitme's avatar
ideahitme committed
51
52
53
|Description   |  Tells a DNS controller to process this service. This is useful when running different DNS controllers at the same time (or different versions of the same controller). The v1 implementation of dns-controller would look for service annotations `dns-controller` and `dns-controller/v1` but not for `mate/v1` or `dns-controller/v2` |
|Default   | dns-controller  |
|Example|dns-controller/v1|
54
|Required| false |
ideahitme's avatar
ideahitme committed
55
|---|---|
56
|Tag   |external-dns.alpha.kubernetes.io/hostname   |
57
|Description   |  Fully qualified name of the desired record |
ideahitme's avatar
ideahitme committed
58
59
|Default| none |
|Example|foo.example.org|
60
|Required| Only for services. Ingress hostname is retrieved from `spec.rules.host` meta data on ingress |
ideahitme's avatar
ideahitme committed
61
62
63
64
65

### Compatibility

External DNS should be compatible with annotations used by three above mentioned projects. The idea is that resources created and tagged with annotations for other projects should continue to be valid and now managed by External DNS. 

ideahitme's avatar
ideahitme committed
66
67
**Mate**

68
69
Mate does not require services/ingress to be tagged. Therefore, it is not safe to run both Mate and External-DNS simultaneously. The idea is that initial release (?) of External DNS will support Mate annotations, which indicates the hostname to be created. Therefore the switch should be simple. 

ideahitme's avatar
ideahitme committed
70
|Annotations |  |
ideahitme's avatar
ideahitme committed
71
72
73
74
75
|---|---|
|Tag   |zalando.org/dnsname  |
|Description   |  Hostname to be registered |
|Default   | Empty(falls back to template based approach) |
|Example|foo.example.org|
76
|Required| false|
ideahitme's avatar
ideahitme committed
77

78
**route53-kubernetes**
79
80
81

It should be safe to run both `route53-kubernetes` and `external-dns` simultaneously. Since `route53-kubernetes` only looks at services with the label `dns=route53` and does not support ingress there should be no collisions between annotations. If users desire to switch to `external-dns` they can run both controllers and migrate services over as they are able.

ideahitme's avatar
ideahitme committed
82
83
84

### Ownership

85
86
87
External DNS should be *responsible* for the created records. Which means that the records should be tagged and only tagged records are viable for future deletion/update. It should not mess with pre-existing records created via other means.

#### Ownership via TXT records
ideahitme's avatar
ideahitme committed
88

89
Each record managed by External DNS is accompanied with a TXT record with a specific value to indicate that corresponding DNS record is managed by External DNS and it can be updated/deleted respectively. TXT records are limited to lifetimes of service/ingress objects and are created/deleted once k8s resources are created/deleted.