DEV Community

Set custom configuration in AWS EKS CoreDNS Addon

When you enable managed addons in EKS, they come with predefined configurations. Nevertheless, there are situations where we have to override them. This gist shows how to set custom configuration for the CoreDNS addon using terraform-aws-modules/terraform-aws-eks and via the AWS console.

...
addons = {
    coredns = {
      addon_version = "v1.11.4-eksbuild.2"
      most_recent   = true
      configuration_values = <<EOT
      {
        "corefile": ".:53 {\n  errors\n  health {\n    lameduck 5s\n  }\n  ready\n  kubernetes cluster.local in-addr.arpa ip6.arpa {\n    pods insecure\n    fallthrough in-addr.arpa ip6.arpa\n  }\n  prometheus :9153\n  forward . /etc/resolv.conf\n  cache 30\n  loop\n  reload\n  loadbalance\n}",
        "autoScaling": {
          "enabled": true,
          "minReplicas": 4,
          "maxReplicas": 8
        },
        "tolerations": [
          {
            "key": "AppsOnly",
            "effect": "NoSchedule",
            "operator": "Equal",
            "value": "apps"
          },
          {
            "key": "CriticalAddonsOnly",
            "effect": "NoSchedule",
            "operator": "Exists"
          }
        ]
      }
      EOT
    }
  }
...
Enter fullscreen mode Exit fullscreen mode
module "eks" {
  source = "terraform-aws-modules/terraform-aws-eks"
  ...
  cluster_addons = var.addons
  ...
}
Enter fullscreen mode Exit fullscreen mode

OpsGist - Tried‑and‑worked snippets and insights I’ve come across.

Top comments (0)