Kubernetes: ExternalDNS – records retrieval failed: failed to list hosted zones: Throttling: status code: 400

By | 04/09/2021

We have an ExternalDNS service running, see the Kubernetes: update AWS Route53 DNS from an Ingress post, which started sending a lot of messages like:

msg=”failed to list resource records sets for zone /hostedzone/Z2VM3W5SRY4I9J: Throttling: \n\tstatus code: 400

And even AWS Console in the Route53 says “Throttling error that was caused because API rate was exceeded. Try again later.“:

The issue is obvious enough: ExternalDNS makes too many requests to the AWS API.

To solve it, add two options – --interval and --events.

In the --interval specify to check for updates once per two minute instead of the default 1 minute, see Parameters, and --events will activate an additional handler of the ExternalDNS which will trigger an API action if an update will be found in Kubernetes Ingress objects.

We are deploying ExternalDNS with Ansible and Helm – update its Ansible task:

- name: "Deploy ExternalDNS chart inside {{ eks_env }}-devops-external-dns-ns namespace (and create it)"
  community.kubernetes.helm:
    kubeconfig: "{{ kube_config_path }}"
    name: "external-dns"
    chart_ref: "bitnami/external-dns"
    release_namespace: "{{ eks_env }}-devops-external-dns-ns"
    create_namespace: true
    values:
      interval: 2m
      triggerLoopOnEvent: true
    ...

Deploy, and now everything is clear.