Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#3853 from anthonycorbacho/doc/trae…
Browse files Browse the repository at this point in the history
…fik-ingress-annotations

doc: Add example of setting up traefik IngressRoute with externalDNS annotations
  • Loading branch information
k8s-ci-robot authored Aug 10, 2023
2 parents 725cdd0 + d5e97fa commit 03cfcc0
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/tutorials/traefik-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,47 @@ spec:
- --registry=txt
- --txt-owner-id=my-identifier
```
## Deploying a Traefik IngressRoute
Create a IngressRoute file called 'traefik-ingress.yaml' with the following contents:
```yaml
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: traefik-ingress
annotations:
external-dns.alpha.kubernetes.io/target: traefik.example.com
kubernetes.io/ingress.class: traefik
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`application.example.com`)
kind: Rule
services:
- name: service
namespace: namespace
port: port
```
Note the annotation on the IngressRoute (`external-dns.alpha.kubernetes.io/target`); use the same hostname as the traefik DNS.

ExternalDNS uses this annotation to determine what services should be registered with DNS.

Create the IngressRoute:

```
$ kubectl create -f traefik-ingress.yaml
```

Depending where you run your IngressRoute it can take a little while for ExternalDNS synchronize the DNS record.

## Cleanup

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

```
$ kubectl delete -f traefik-ingress.yaml
$ kubectl delete -f externaldns.yaml
```

0 comments on commit 03cfcc0

Please sign in to comment.