README.md 11.7 KB
Newer Older
1
2
3
4
<p align="center">
	<img src="img/external-dns.png" width="40%" align="center" alt="ExternalDNS">
</p>

Lauri Apple's avatar
Lauri Apple committed
5
# ExternalDNS
6
7
[![Build Status](https://travis-ci.org/kubernetes-incubator/external-dns.svg?branch=master)](https://travis-ci.org/kubernetes-incubator/external-dns)
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-incubator/external-dns/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-incubator/external-dns?branch=master)
8
[![GitHub release](https://img.shields.io/github/release/kubernetes-incubator/external-dns.svg)](https://github.com/kubernetes-incubator/external-dns/releases)
9
[![go-doc](https://godoc.org/github.com/kubernetes-incubator/external-dns?status.svg)](https://godoc.org/github.com/kubernetes-incubator/external-dns)
10
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes-incubator/external-dns)](https://goreportcard.com/report/github.com/kubernetes-incubator/external-dns)
Henning Jacobs's avatar
title    
Henning Jacobs committed
11

Lauri Apple's avatar
Lauri Apple committed
12
ExternalDNS synchronizes exposed Kubernetes Services and Ingresses with DNS providers.
Henning Jacobs's avatar
Henning Jacobs committed
13

Lauri Apple's avatar
Lauri Apple committed
14
## What It Does
Henning Jacobs's avatar
Henning Jacobs committed
15

16
Inspired by [Kubernetes DNS](https://github.com/kubernetes/dns), Kubernetes' cluster-internal DNS server, ExternalDNS makes Kubernetes resources discoverable via public DNS servers. Like KubeDNS, it retrieves a list of resources (Services, Ingresses, etc.) from the [Kubernetes API](https://kubernetes.io/docs/api/) to determine a desired list of DNS records. *Unlike* KubeDNS, however, it's not a DNS server itself, but merely configures other DNS providers accordingly—e.g. [AWS Route 53](https://aws.amazon.com/route53/) or [Google CloudDNS](https://cloud.google.com/dns/docs/).
Henning Jacobs's avatar
Henning Jacobs committed
17

Lauri Apple's avatar
Lauri Apple committed
18
In a broader sense, ExternalDNS allows you to control DNS records dynamically via Kubernetes resources in a DNS provider-agnostic way.
19

20
21
The [FAQ](docs/faq.md) contains additional information and addresses several questions about key concepts of ExternalDNS.

22
23
To see ExternalDNS in action, have a look at this [video](https://www.youtube.com/watch?v=9HQ2XgL9YVI).

24
## The Latest Release: v0.5
25

26
ExternalDNS' current release is `v0.5`. This version allows you to keep selected zones (via `--domain-filter`) synchronized with Ingresses and Services of `type=LoadBalancer` in various cloud providers:
27
28
* [Google CloudDNS](https://cloud.google.com/dns/docs/)
* [AWS Route 53](https://aws.amazon.com/route53/)
29
* [AWS Service Discovery](https://docs.aws.amazon.com/Route53/latest/APIReference/overview-service-discovery.html)
30
* [AzureDNS](https://azure.microsoft.com/en-us/services/dns)
31
* [CloudFlare](https://www.cloudflare.com/dns)
32
* [DigitalOcean](https://www.digitalocean.com/products/networking)
33
* [DNSimple](https://dnsimple.com/)
34
* [Infoblox](https://www.infoblox.com/products/dns/)
Julian Vassev's avatar
Julian Vassev committed
35
* [Dyn](https://dyn.com/dns/)
36
37
* [OpenStack Designate](https://docs.openstack.org/designate/latest/)
* [PowerDNS](https://www.powerdns.com/)
Nick Jüttner's avatar
Nick Jüttner committed
38
* [CoreDNS](https://coredns.io/)
39
* [Exoscale](https://www.exoscale.com/dns/)
40
* [Oracle Cloud Infrastructure DNS](https://docs.cloud.oracle.com/iaas/Content/DNS/Concepts/dnszonemanagement.htm)
41
* [Linode DNS](https://www.linode.com/docs/networking/dns/)
42
* [RFC2136](https://tools.ietf.org/html/rfc2136)  
Henning Jacobs's avatar
Henning Jacobs committed
43

44
From this release, ExternalDNS can become aware of the records it is managing (enabled via `--registry=txt`), therefore ExternalDNS can safely manage non-empty hosted zones. We strongly encourage you to use `v0.5` (or greater) with `--registry=txt` enabled and `--txt-owner-id` set to a unique value that doesn't change for the lifetime of your cluster. You might also want to run ExternalDNS in a dry run mode (`--dry-run` flag) to see the changes to be submitted to your DNS Provider API.
45

46
47
48
49
Note that all flags can be replaced with environment variables; for instance,
`--dry-run` could be replaced with `EXTERNAL_DNS_DRY_RUN=1`, or
`--registry txt` could be replaced with `EXTERNAL_DNS_REGISTRY=txt`.

50
51
52
53
## Deploying to a Cluster

The following tutorials are provided:

xianlubird's avatar
xianlubird committed
54
* [Alibaba Cloud](docs/tutorials/alibabacloud.md)
55
56
* [AWS (Route53)](docs/tutorials/aws.md)
* [AWS (Service Discovery)](docs/tutorials/aws-sd.md)
57
58
59
* [Azure](docs/tutorials/azure.md)
* [Cloudflare](docs/tutorials/cloudflare.md)
* [DigitalOcean](docs/tutorials/digitalocean.md)
60
* [Infoblox](docs/tutorials/infoblox.md)
Julian Vassev's avatar
Julian Vassev committed
61
* [Dyn](docs/tutorials/dyn.md)
62
63
64
* Google Container Engine
	* [Using Google's Default Ingress Controller](docs/tutorials/gke.md)
	* [Using the Nginx Ingress Controller](docs/tutorials/nginx-ingress.md)
65
* [Exoscale](docs/tutorials/exoscale.md)
Andrew Pryde's avatar
Andrew Pryde committed
66
* [Oracle Cloud Infrastructure (OCI) DNS](docs/tutorials/oracle.md)
cliedeman's avatar
cliedeman committed
67
* [Linode](docs/tutorials/linode.md)
68
* [RFC2136](docs/tutorials/rfc2136.md)
69
70
71

## Running Locally

Lauri Apple's avatar
Lauri Apple committed
72
### Technical Requirements
Henning Jacobs's avatar
Henning Jacobs committed
73

Lauri Apple's avatar
Lauri Apple committed
74
75
Make sure you have the following prerequisites:
* A local Go 1.7+ development environment.
76
* Access to a Google/AWS account with the DNS API enabled.
Lauri Apple's avatar
Lauri Apple committed
77
78
79
80
81
* Access to a Kubernetes cluster that supports exposing Services, e.g. GKE.

### Setup Steps

First, get ExternalDNS:
Henning Jacobs's avatar
Henning Jacobs committed
82

83
84
**To install all dependencies, make sure to install [dep](https://github.com/golang/dep) first.**

85
```console
86
87
88
$ git clone https://github.com/kubernetes-incubator/external-dns.git && cd external-dns
$ dep ensure -vendor-only
$ make
89
```
Henning Jacobs's avatar
Henning Jacobs committed
90

91
92
This will create external-dns in the build directory directly from master.

Lauri Apple's avatar
Lauri Apple committed
93
Next, run an application and expose it via a Kubernetes Service:
Henning Jacobs's avatar
Henning Jacobs committed
94

95
96
97
98
```console
$ kubectl run nginx --image=nginx --replicas=1 --port=80
$ kubectl expose deployment nginx --port=80 --target-port=80 --type=LoadBalancer
```
99

100
Annotate the Service with your desired external DNS name. Make sure to change `example.org` to your domain.
101

102
103
104
```console
$ kubectl annotate service nginx "external-dns.alpha.kubernetes.io/hostname=nginx.example.org."
```
105

106
107
108
109
110
111
112
113
Optionally, you can customize the TTL value of the resulting DNS record by using the `external-dns.alpha.kubernetes.io/ttl` annotation:

```console
$ kubectl annotate service nginx "external-dns.alpha.kubernetes.io/ttl=10"
```

For more details on configuring TTL, see [here](docs/ttl.md).

114
Locally run a single sync loop of ExternalDNS.
115

116
```console
117
$ external-dns --registry txt --txt-owner-id my-cluster-id --provider google --google-project example-project --source service --once --dry-run
118
```
Henning Jacobs's avatar
Henning Jacobs committed
119

120
This should output the DNS records it will modify to match the managed zone with the DNS records you desire. Note TXT records having `my-cluster-id` value embedded. Those are used to ensure that ExternalDNS is aware of the records it manages.
Henning Jacobs's avatar
Henning Jacobs committed
121

122
Once you're satisfied with the result, you can run ExternalDNS like you would run it in your cluster: as a control loop, and **not in dry-run** mode:
123
124

```console
125
$ external-dns --registry txt --txt-owner-id my-cluster-id --provider google --google-project example-project --source service
126
127
```

Lauri Apple's avatar
Lauri Apple committed
128
Check that ExternalDNS has created the desired DNS record for your Service and that it points to its load balancer's IP. Then try to resolve it:
129
130
131
132
133
134
135
136
137
138
139
140

```console
$ dig +short nginx.example.org.
104.155.60.49
```

Now you can experiment and watch how ExternalDNS makes sure that your DNS records are configured as desired. Here are a couple of things you can try out:
* Change the desired hostname by modifying the Service's annotation.
* Recreate the Service and see that the DNS record will be updated to point to the new load balancer IP.
* Add another Service to create more DNS records.
* Remove Services to clean up your managed zone.

Lauri Apple's avatar
Lauri Apple committed
141
The [tutorials](docs/tutorials) section contains examples, including Ingress resources, and shows you how to set up ExternalDNS in different environments such as other cloud providers and alternative Ingress controllers.
142

143
144
145
146
# Note

If using a txt registry and attempting to use a CNAME the `--txt-prefix` must be set to avoid conflicts.  Changing `--txt-prefix` will result in lost ownership over previously created records.

147
148
# Roadmap

Lauri Apple's avatar
Lauri Apple committed
149
ExternalDNS was built with extensibility in mind. Adding and experimenting with new DNS providers and sources of desired DNS records should be as easy as possible. It should also be possible to modify how ExternalDNS behaves—e.g. whether it should add records but never delete them.
150

151
Here's a rough outline on what is to come (subject to change):
152
153
154

### v0.1

155
156
- [x] Support for Google CloudDNS
- [x] Support for Kubernetes Services
157
158
159

### v0.2

160
161
- [x] Support for AWS Route 53
- [x] Support for Kubernetes Ingresses
162

163
### v0.3
164

165
166
167
- [x] Support for AWS Route 53 via ALIAS
- [x] Support for multiple zones
- [x] Ownership System
168

169
### v0.4
170
171
172
173
174
175

- [x] Support for AzureDNS
- [x] Support for CloudFlare
- [x] Support for DigitalOcean
- [x] Multiple DNS names per Service

176
### v0.5 - _current version_
177

178
179
180
- [x] Support for creating DNS records to multiple targets (for Google and AWS)
- [x] Support for OpenStack Designate
- [x] Support for PowerDNS
181
182
183
184
185

### v0.6

- [ ] Ability to replace Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/master/dns-controller) (This could also directly become `v1.0`)

186
187
### v1.0

188
- [ ] Ability to replace Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/master/dns-controller)
189
- [x] Ability to replace Zalando's [Mate](https://github.com/linki/mate)
190
- [x] Ability to replace Molecule Software's [route53-kubernetes](https://github.com/wearemolecule/route53-kubernetes)
191
192
193

### Yet to be defined

194
* Support for CoreDNS
195
196
197
* Support for record weights
* Support for different behavioral policies
* Support for Services with `type=NodePort`
198
* Support for CRDs
199
200
* Support for more advanced DNS record configurations

201
202
Have a look at [the milestones](https://github.com/kubernetes-incubator/external-dns/milestones) to get an idea of where we currently stand.

Lauri Apple's avatar
Lauri Apple committed
203
## Contributing
204

205
We encourage you to get involved with ExternalDNS, as users, contributors or as new maintainers that can take over some parts like different providers and help with code reviews.
206

207
208
209
210
211
212
213
214
215
216
217
Providers which currently need maintainers:

* Azure
* Cloudflare
* Digital Ocean
* Google Cloud Platform

Any provider should have at least one maintainer. It would be nice if you run it in production, but it is not required.
You should check changes and make sure your provider is working correctly.

It would be also great to have an automated end-to-end test for different cloud providers, so help from Kubernetes maintainers and their idea on how this can be done would be valuable.
218

219
220
221
222
223
Read the [contributing guidelines](CONTRIBUTING.md) and have a look at [the contributing docs](docs/contributing/getting-started.md) to learn about building the project, the project structure, and the purpose of each package.

If you are interested please reach out to us on the [Kubernetes slack](http://slack.k8s.io) in the #external-dns channel.

For an overview on how to write new Sources and Providers check out [Sources and Providers](docs/contributing/sources-and-providers.md).
224

Lauri Apple's avatar
Lauri Apple committed
225
## Heritage
226

Lauri Apple's avatar
Lauri Apple committed
227
ExternalDNS is an effort to unify the following similar projects in order to bring the Kubernetes community an easy and predictable way of managing DNS records across cloud providers based on their Kubernetes resources:
228
229

* Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/master/dns-controller)
230
* Zalando's [Mate](https://github.com/linki/mate)
231
* Molecule Software's [route53-kubernetes](https://github.com/wearemolecule/route53-kubernetes)
232
233
234
235
236
237
238
239
240
241
242

## Kubernetes Incubator

This is a [Kubernetes Incubator project](https://github.com/kubernetes/community/blob/master/incubator.md).
The project was established 2017-Feb-9 (initial announcement [here](https://groups.google.com/forum/#!searchin/kubernetes-dev/external$20dns%7Csort:relevance/kubernetes-dev/2wGQUB0fUuE/9OXz01i2BgAJ)).
The incubator team for the project is:

* Sponsor: sig-network
* Champion: Tim Hockin (@thockin)
* SIG: sig-network

Lauri Apple's avatar
Lauri Apple committed
243
244
245
246
247
For more information about sig-network, such as meeting times and agenda, check out the [community site](https://github.com/kubernetes/community/tree/master/sig-network).

### Code of conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).