Create DNS records from Ingress

Learn how to create DNS records from Ingress

cloudflare-operator can create DNS records from Ingress resources. This guide shows how to configure the controller to automatically create DNS records for your Ingress resources.

Ingress annotations

The following annotation is required: cloudflare-operator.io/content or cloudflare-operator.io/ip-ref

To skip the creation of a DNS record, use the annotation cloudflare-operator.io/ignore: "true"
If the DNSRecord was previously created, it get’s deleted after setting the ignore annotation.

The following annotations are optional:

Annotation Value Description
cloudflare-operator.io/content IP address or domain DNS record content (e.g. 69.42.0.69)
cloudflare-operator.io/ip-ref Reference to an IP object e.g. my-external-ip
cloudflare-operator.io/proxied true or false Whether the record should be proxied
cloudflare-operator.io/ttl 1 or 60 - 86400 TTL of the DNS record
cloudflare-operator.io/type A, AAAA or CNAME Desired DNS record type
cloudflare-operator.io/interval e.g. 5m0s Interval at which the DNSRecord object should be reconciled

An example Ingress resource with annotations:

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cloudflare-operator.io/type: CNAME
    cloudflare-operator.io/content: example.com
  name: blog
  namespace: blog
spec:
  rules:
    - host: blog.example.com
      http:
        paths:
          - backend:
              service:
                name: blog
                port:
                  name: http
            path: /
            pathType: Prefix

This will create a DNS record for the host blog.example.com with the content example.com and the type CNAME.

Last modified August 14, 2023: fix: use correct interval format (1009d41)