README.md 15.4 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
[![Build Status](https://github.com/kubernetes-sigs/external-dns/workflows/Go/badge.svg)](https://github.com/kubernetes-sigs/external-dns/actions)
7
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/external-dns/badge.svg)](https://coveralls.io/github/kubernetes-sigs/external-dns)
8
9
10
[![GitHub release](https://img.shields.io/github/release/kubernetes-sigs/external-dns.svg)](https://github.com/kubernetes-sigs/external-dns/releases)
[![go-doc](https://godoc.org/github.com/kubernetes-sigs/external-dns?status.svg)](https://godoc.org/github.com/kubernetes-sigs/external-dns)
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes-sigs/external-dns)](https://goreportcard.com/report/github.com/kubernetes-sigs/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 Cloud DNS](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.

vanhumbeecka's avatar
vanhumbeecka committed
22
To see ExternalDNS in action, have a look at this [video](https://www.youtube.com/watch?v=9HQ2XgL9YVI) or read this [blogpost](https://codemine.be/posts/20190125-devops-eks-externaldns/).
23

24
## The Latest Release: v0.7
25

26
ExternalDNS' current release is `v0.7`. This version allows you to keep selected zones (via `--domain-filter`) synchronized with Ingresses and Services of `type=LoadBalancer` in various cloud providers:
27
* [Google Cloud DNS](https://cloud.google.com/dns/docs/)
28
* [AWS Route 53](https://aws.amazon.com/route53/)
29
* [AWS Cloud Map](https://docs.aws.amazon.com/cloud-map/)
30
* [AzureDNS](https://azure.microsoft.com/en-us/services/dns)
31
* [CloudFlare](https://www.cloudflare.com/dns)
32
* [RcodeZero](https://www.rcodezero.at/)
33
* [DigitalOcean](https://www.digitalocean.com/products/networking)
Vladimir Smagin's avatar
Vladimir Smagin committed
34
* [Hetzner](https://hetzner.com/)
35
* [DNSimple](https://dnsimple.com/)
36
* [Infoblox](https://www.infoblox.com/products/dns/)
Julian Vassev's avatar
Julian Vassev committed
37
* [Dyn](https://dyn.com/dns/)
38
39
* [OpenStack Designate](https://docs.openstack.org/designate/latest/)
* [PowerDNS](https://www.powerdns.com/)
Nick Jüttner's avatar
Nick Jüttner committed
40
* [CoreDNS](https://coredns.io/)
41
* [Exoscale](https://www.exoscale.com/dns/)
42
* [Oracle Cloud Infrastructure DNS](https://docs.cloud.oracle.com/iaas/Content/DNS/Concepts/dnszonemanagement.htm)
43
* [Linode DNS](https://www.linode.com/docs/networking/dns/)
44
* [RFC2136](https://tools.ietf.org/html/rfc2136)
45
* [NS1](https://ns1.com/)
Reinier Schoof's avatar
Reinier Schoof committed
46
* [TransIP](https://www.transip.eu/domain-name/)
Dave Grizzanti's avatar
Dave Grizzanti committed
47
* [VinylDNS](https://www.vinyldns.io)
David Dymko's avatar
David Dymko committed
48
* [Vultr](https://www.vultr.com)
Hugome's avatar
Hugome committed
49
* [OVH](https://www.ovh.com)
50
* [Scaleway](https://www.scaleway.com)
Henning Jacobs's avatar
Henning Jacobs committed
51

52
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.
53

54
55
56
57
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`.

58
59
## Status of providers

60
ExternalDNS supports multiple DNS providers which have been implemented by the [ExternalDNS contributors](https://github.com/kubernetes-sigs/external-dns/graphs/contributors). Maintaining all of those in a central repository is a challenge and we have limited resources to test changes. This means that it is very hard to test all providers for possible regressions and, as written in the [Contributing](#Contributing) section, we encourage contributors to step in as maintainers for the individual providers and help by testing the integrations.
61
62
63
64
65
66
67

End-to-end testing of ExternalDNS is currently
[performed](https://github.com/zalando-incubator/kubernetes-on-aws/blob/dev/test/e2e/external_dns.go)
in the separate
[kubernetes-on-aws](https://github.com/zalando-incubator/kubernetes-on-aws)
repository.

68
69
70
71
72
73
74
75
We define the following stability levels for providers:

- **Stable**: Used for smoke tests before a release, used in production and maintainers are active.
- **Beta**: Community supported, well tested, but maintainers have no access to resources to execute integration tests on the real platform and/or are not using it in production.
- **Alpha**: Community provided with no support from the maintainers apart from reviewing PRs.

The following table clarifies the current status of the providers according to the aforementioned stability levels:

76
| Provider | Status | Maintainers |
Raffaele Di Fazio's avatar
Raffaele Di Fazio committed
77
| -------- | ------ | ----------- |
78
79
80
81
82
83
84
| Google Cloud DNS | Stable | |
| AWS Route 53 | Stable | |
| AWS Cloud Map | Beta | |
| AzureDNS | Beta | |
| CloudFlare | Beta | |
| RcodeZero | Alpha | |
| DigitalOcean | Alpha | |
Vladimir Smagin's avatar
Vladimir Smagin committed
85
| Hetzner | Alpha | @21h |
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
| DNSimple | Alpha | |
| Infoblox | Alpha | @saileshgiri |
| Dyn | Alpha | |
| OpenStack Designate | Alpha | |
| PowerDNS | Alpha | |
| CoreDNS | Alpha | |
| Exoscale | Alpha | |
| Oracle Cloud Infrastructure DNS | Alpha | |
| Linode DNS | Alpha | |
| RFC2136 | Alpha | |
| NS1 | Alpha | |
| TransIP | Alpha | |
| VinylDNS | Alpha | |
| RancherDNS | Alpha | |
| Akamai FastDNS | Alpha | |
| OVH | Alpha | |
102
| Scaleway DNS | Alpha | @Sh4d1 |
David Dymko's avatar
David Dymko committed
103
| Vultr | Alpha | |
104
| UltraDNS | Alpha | |
105
106
107
108
109

## Running ExternalDNS:

The are two ways of running ExternalDNS:

110
111
112
* Deploying to a Cluster
* Running Locally

113
### Deploying to a Cluster
114
115
116

The following tutorials are provided:

xianlubird's avatar
xianlubird committed
117
* [Alibaba Cloud](docs/tutorials/alibabacloud.md)
118
119
120
121
* AWS
	* [ALB Ingress Controller](docs/tutorials/alb-ingress.md)
	* [Route53](docs/tutorials/aws.md)
		* [Same domain for public and private Route53 zones](docs/tutorials/public-private-route53.md)
122
	* [Cloud Map](docs/tutorials/aws-sd.md)
123
	* [Kube Ingress AWS Controller](docs/tutorials/kube-ingress-aws.md)
124
125
* [Azure DNS](docs/tutorials/azure.md)
* [Azure Private DNS](docs/tutorials/azure-private-dns.md)
126
* [Cloudflare](docs/tutorials/cloudflare.md)
127
* [CoreDNS](docs/tutorials/coredns.md)
128
* [DigitalOcean](docs/tutorials/digitalocean.md)
Vladimir Smagin's avatar
Vladimir Smagin committed
129
* [Hetzner](docs/tutorials/hetzner.md)
130
* [DNSimple](docs/tutorials/dnsimple.md)
Julian Vassev's avatar
Julian Vassev committed
131
* [Dyn](docs/tutorials/dyn.md)
132
133
* [Exoscale](docs/tutorials/exoscale.md)
* [ExternalName Services](docs/tutorials/externalname.md)
134
135
136
* Google Container Engine
	* [Using Google's Default Ingress Controller](docs/tutorials/gke.md)
	* [Using the Nginx Ingress Controller](docs/tutorials/nginx-ingress.md)
137
138
139
140
* [Headless Services](docs/tutorials/hostport.md)
* [Infoblox](docs/tutorials/infoblox.md)
* [Istio Gateway Source](docs/tutorials/istio.md)
* [Kubernetes Security Context](docs/tutorials/security-context.md)
cliedeman's avatar
cliedeman committed
141
* [Linode](docs/tutorials/linode.md)
142
* [Nginx Ingress Controller](docs/tutorials/nginx-ingress.md)
143
* [NS1](docs/tutorials/ns1.md)
144
* [NS Record Creation with CRD Source](docs/tutorials/ns-record.md)
145
146
147
148
149
150
* [OpenStack Designate](docs/tutorials/designate.md)
* [Oracle Cloud Infrastructure (OCI) DNS](docs/tutorials/oracle.md)
* [PowerDNS](docs/tutorials/pdns.md)
* [RcodeZero](docs/tutorials/rcodezero.md)
* [RancherDNS (RDNS)](docs/tutorials/rdns.md)
* [RFC2136](docs/tutorials/rfc2136.md)
Reinier Schoof's avatar
Reinier Schoof committed
151
* [TransIP](docs/tutorials/transip.md)
152
* [VinylDNS](docs/tutorials/vinyldns.md)
Hugome's avatar
Hugome committed
153
* [OVH](docs/tutorials/ovh.md)
154
* [Scaleway](docs/tutorials/scaleway.md)
David Dymko's avatar
David Dymko committed
155
* [Vultr](docs/tutorials/vultr.md)
156
* [UltraDNS](docs/tutorials/ultradns.md)
157

158
### Running Locally
159

160
161
See the [contributor guide](docs/contributing/getting-started.md) for details on compiling
from source.
Lauri Apple's avatar
Lauri Apple committed
162

163
#### Setup Steps
Lauri Apple's avatar
Lauri Apple committed
164
165

Next, run an application and expose it via a Kubernetes Service:
Henning Jacobs's avatar
Henning Jacobs committed
166

167
168
169
170
```console
$ kubectl run nginx --image=nginx --replicas=1 --port=80
$ kubectl expose deployment nginx --port=80 --target-port=80 --type=LoadBalancer
```
171

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

174
175
176
```console
$ kubectl annotate service nginx "external-dns.alpha.kubernetes.io/hostname=nginx.example.org."
```
177

178
179
180
181
182
183
184
185
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).

186
Locally run a single sync loop of ExternalDNS.
187

188
```console
189
$ external-dns --registry txt --txt-owner-id my-cluster-id --provider google --google-project example-project --source service --once --dry-run
190
```
Henning Jacobs's avatar
Henning Jacobs committed
191

192
193
194
This should output the DNS records it will modify to match the managed zone with the DNS records you desire. It also assumes you are running in the `default` namespace. See the [FAQ](docs/faq.md) for more information regarding namespaces.

Note: TXT records will have `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
195

196
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:
197
198

```console
199
$ external-dns --registry txt --txt-owner-id my-cluster-id --provider google --google-project example-project --source service
200
201
```

Lauri Apple's avatar
Lauri Apple committed
202
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:
203
204
205
206
207
208
209
210
211
212
213
214

```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
215
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.
216

217
218
219
220
# 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.

Sergei Zyubin's avatar
Sergei Zyubin committed
221
222
If `externalIPs` list is defined for a `LoadBalancer` service, this list will be used instead of an assigned load balancer IP to create a DNS record. It's useful when you run bare metal Kubernetes clusters behind NAT or in a similar setup, where a load balancer IP differs from a public IP (e.g. with [MetalLB](https://metallb.universe.tf)).

223
224
# Roadmap

Lauri Apple's avatar
Lauri Apple committed
225
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.
226

227
Here's a rough outline on what is to come (subject to change):
228
229
230

### v0.1

231
232
- [x] Support for Google CloudDNS
- [x] Support for Kubernetes Services
233
234
235

### v0.2

236
237
- [x] Support for AWS Route 53
- [x] Support for Kubernetes Ingresses
238

239
### v0.3
240

241
242
243
- [x] Support for AWS Route 53 via ALIAS
- [x] Support for multiple zones
- [x] Ownership System
244

245
### v0.4
246
247
248
249
250
251

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

252
### v0.5
253

254
255
256
- [x] Support for creating DNS records to multiple targets (for Google and AWS)
- [x] Support for OpenStack Designate
- [x] Support for PowerDNS
257
- [x] Support for Linode
njuettner's avatar
njuettner committed
258
- [x] Support for RcodeZero
259
- [x] Support for NS1
260
- [x] Support for TransIP
261
- [x] Support for Azure Private DNS
262
263
264

### v0.6

265
- [ ] Ability to replace Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/HEAD/dns-controller) (This could also directly become `v1.0`)
Hugome's avatar
Hugome committed
266
- [x] Support for OVH
267

268
269
### v1.0

270
- [ ] Ability to replace Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/HEAD/dns-controller)
271
- [x] Ability to replace Zalando's [Mate](https://github.com/linki/mate)
272
- [x] Ability to replace Molecule Software's [route53-kubernetes](https://github.com/wearemolecule/route53-kubernetes)
273
274
275

### Yet to be defined

276
* Support for CoreDNS
277
278
279
* Support for record weights
* Support for different behavioral policies
* Support for Services with `type=NodePort`
280
* Support for CRDs
281
282
* Support for more advanced DNS record configurations

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

Lauri Apple's avatar
Lauri Apple committed
285
## Contributing
286

287
288
289
Are you interested in contributing to external-dns? We, the maintainers and community, would love your
suggestions, contributions, and help! Also, the maintainers can be contacted at any time to learn more
about how to get involved.
290

291
292
293
294
295
We also encourage ALL active community participants to act as if they are maintainers, even if you don't have
"official" write permissions. This is a community effort, we are here to serve the Kubernetes community. If you
have an active interest and you want to get involved, you have real power! Don't assume that the only people who
can get things done around here are the "maintainers". We also would love to add more "official" maintainers, so
show us what you can do!
296

297
298
299
300
The external-dns project is currently in need of maintainers for specific DNS providers. Ideally each provider
would have at least two maintainers. It would be nice if the maintainers run the provider in production, but it
is not strictly required. Provider listed [here](https://github.com/kubernetes-sigs/external-dns#status-of-providers)
that do not have a maintainer listed are in need of assistance.
301
302
303
304

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.

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

Lauri Apple's avatar
Lauri Apple committed
306
## Heritage
307

Lauri Apple's avatar
Lauri Apple committed
308
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:
309

310
* Kops' [DNS Controller](https://github.com/kubernetes/kops/tree/HEAD/dns-controller)
311
* Zalando's [Mate](https://github.com/linki/mate)
312
* Molecule Software's [route53-kubernetes](https://github.com/wearemolecule/route53-kubernetes)
313

314
### User Demo How-To Blogs and Examples
315

JPantsjoha's avatar
JPantsjoha committed
316
* A full demo on GKE Kubernetes. See [How-to Kubernetes with DNS management (ssl-manager pre-req)](https://medium.com/@jpantjsoha/how-to-kubernetes-with-dns-management-for-gitops-31239ea75d8d)
317
* Run external-dns on GKE with workload identity. See [Kubernetes, ingress-nginx, cert-manager & external-dns](https://blog.atomist.com/kubernetes-ingress-nginx-cert-manager-external-dns/)