Skip to content

Commit

Permalink
tutorials: add tutorial for digital ocean (#282)
Browse files Browse the repository at this point in the history
* docs(tutorials): add tutorial for digital ocean

* docs(tutorials): fix version used in cloudflare tutorial

* chore: update the changelog with the latest and greatest, thanks to all who contributed
  • Loading branch information
linki authored Jul 21, 2017
1 parent e891397 commit aa3f6c0
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 8 deletions.
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
- The `external-dns.alpha.kubernetes.io/hostname` annotation accepts now a comma separated list of hostnames and a trailing period is not required anymore.
- The flag `--domain-filter` can be repeated multiple times like `--domain-filter=example.com --domain-filter=company.org.`.
- A trailing period is not required anymore for `--domain-filter` when AWS (or any other) provider is used.

- ExternalDNS now supports three more DNS providers:
* [AzureDNS](https://azure.microsoft.com/en-us/services/dns) @peterhuene
* [CloudFlare](https://www.cloudflare.com/de/dns) @njuettner
* [DigitalOcean](https://www.digitalocean.com/products/networking) @njuettner
- Fixed a bug that prevented ExternalDNS to be run on Tectonic clusters @sstarcher
- ExternalDNS is now a full replace for Molecule Software's `route53-kubernetes` @iterion
- The `external-dns.alpha.kubernetes.io/hostname` annotation accepts now a comma separated list of hostnames and a trailing period is not required anymore. @totallyunknown
- The flag `--domain-filter` can be repeated multiple times like `--domain-filter=example.com --domain-filter=company.org.`. @totallyunknown
- A trailing period is not required anymore for `--domain-filter` when AWS (or any other) provider is used. @totallyunknown
- We added a FakeSource that generates random endpoints and allows to run ExternalDNS without a Kubernetes cluster (e.g. for testing providers) @ismith
- All HTTP requests to external APIs (e.g. DNS providers) generate client side metrics. @linki
- The `--zone` parameter was removed in favor of a provider independent `--domain-filter` flag. @linki
- All flags can now also be set via environment variables. @linki

## v0.3.0 - 2017-05-08

Features:
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using Cloudflare DNS.

Make sure to use **>=0.4.0-alpha.0** version of ExternalDNS for this tutorial.
Make sure to use **>=0.4.0-alpha.2** version of ExternalDNS for this tutorial.

## Creating a Cloudflare DNS zone

Expand Down Expand Up @@ -39,7 +39,7 @@ spec:
spec:
containers:
- name: external-dns
image: registry.opensource.zalan.do/teapot/external-dns:v0.4.0-alpha.0
image: registry.opensource.zalan.do/teapot/external-dns:v0.4.0-alpha.2
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
Expand Down Expand Up @@ -117,9 +117,9 @@ Check your [Cloudflare dasbhboard](https://www.cloudflare.com/a/dns/example.com)

Substitute the zone for the one created above if a different domain was used.

This should show the external IP address of the service as the A record for your domain.
This should show the external IP address of the service as the A record for your domain.

## Cleanup
## Cleanup

Now that we have verified that ExternalDNS will automatically manage Cloudflare DNS records, we can delete the tutorial's example:

Expand Down
122 changes: 122 additions & 0 deletions docs/tutorials/digitalocean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Setting up ExternalDNS for Services on DigitalOcean

This tutorial describes how to setup ExternalDNS for usage within a Kubernetes cluster using DigitalOcean DNS.

Make sure to use **>=0.4.0-alpha.2** version of ExternalDNS for this tutorial.

## Creating a DigitalOcean DNS zone

If you want to learn about how to use DigitalOcean's DNS service read the following tutorial series:

[An Introduction to Managing DNS](https://www.digitalocean.com/community/tutorial_series/an-introduction-to-managing-dns), and specifically [How To Set Up a Host Name with DigitalOcean DNS](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean)

Create a new DNS zone where you want to create your records in. Let's use `example.com` as an example here.

## Creating DigitalOcean Credentials

Generate a new personal token by going to [the API settings](https://cloud.digitalocean.com/settings/api/tokens) or follow [How To Use the DigitalOcean API v2](https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2) if you need more information. Give the token a name and choose read and write access. The token needs to be passed to ExternalDNS so make a note of it for later use.

The environment variable `DO_TOKEN` will be needed to run ExternalDNS with DigitalOcean.

## Deploy ExternalDNS

Create a deployment file called `externaldns.yaml` with the following contents:

```yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: external-dns
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: external-dns
spec:
containers:
- name: external-dns
image: registry.opensource.zalan.do/teapot/external-dns:v0.4.0-alpha.2
args:
- --source=service # ingress is also possible
- --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above.
- --provider=digitalocean
env:
- name: DO_TOKEN
value: "YOUR_DIGITALOCEAN_API_KEY"
```
Create the deployment for ExternalDNS:
```console
$ kubectl create -f externaldns.yaml
```

## Deploying an Nginx Service

Create a service file called 'nginx.yaml' with the following contents:

```yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
external-dns.alpha.kubernetes.io/hostname: my-app.example.com
spec:
selector:
app: nginx
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 80
```
Note the annotation on the service; use the same hostname as the DigitalOcean DNS zone created above.
ExternalDNS uses this annotation to determine what services should be registered with DNS. Removing the annotation will cause ExternalDNS to remove the corresponding DNS records.
Create the deployment and service:
```console
$ kubectl create -f nginx.yaml
```

Depending where you run your service it can take a little while for your cloud provider to create an external IP for the service.

Once the service has an external IP assigned, ExternalDNS will notice the new service IP address and synchronize the DigitalOcean DNS records.

## Verifying DigitalOcean DNS records

Check your [DigitalOcean UI](https://cloud.digitalocean.com/networking/domains) to view the records for your DigitalOcean DNS zone.

Click on the zone for the one created above if a different domain was used.

This should show the external IP address of the service as the A record for your domain.

## Cleanup

Now that we have verified that ExternalDNS will automatically manage DigitalOcean DNS records, we can delete the tutorial's example:

```
$ kubectl delete service -f nginx.yaml
$ kubectl delete service -f externaldns.yaml
```

0 comments on commit aa3f6c0

Please sign in to comment.