How To Update CoreDNS's Resolver Policy

Follow
Table of Contents

Task

This article outlines how to change CoreDNS's forward resolver policy.

Pre-requisites

A custom cluster provisioned by Rancher or RKE with CoreDNS.

The CoreDNS docs explain the various configurations. In this case, we are concerned with the policy. Which defaults to random.

Resolution

To change the policy to sequential, edit your clusters yaml. For RKE provisioned clusters this will be your cluster.yaml and for Rancher provisioned custom clusters this will be found by editing the cluster.

For RKE add the following to the end of the file, but for Rancher provisioned clusters, nest this in the rancher_kubernetes_engine_config section.

addons: |-
  ---
  apiVersion: v1
  kind: ConfigMap
  metadata:
    name: coredns
    namespace: kube-system
  data:
    Corefile: |
      .:53 {
          errors
          health
          ready
          kubernetes cluster.local in-addr.arpa ip6.arpa {
            pods insecure
            fallthrough in-addr.arpa ip6.arpa
          }
          prometheus :9153
          forward . "/etc/resolv.conf" {
            policy sequential
          }
          cache 30
          loop
          reload
          loadbalance
      }

The lines of note here are the following, which are changed from just forward . "/etc/resolv.conf".

          forward . "/etc/resolv.conf" {
            policy sequential
          }

At this point you should be able to just hit save in Rancher or run rke up and the change will be pushed to the cluster.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.