doc: Add example of setting up traefik IngressRoute with externalDNS annotations

This commit is contained in:
Anthony Corbacho 2023-08-10 16:15:37 +09:00
parent 725cdd0465
commit b7973ebb4c

View File

@ -94,3 +94,46 @@ 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
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
```