Skip to content
Install the CLI

Reference experimental

coredns

These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.

CoreDNS as the cluster DNS: a Corefile built from typed server blocks, a Service at the kubelet’s clusterDNS address, and the dns role

This page is generated from kix/packages/experimental/coredns.

StabilityExperimental
package valuepackages.experimental.coredns
Default software version1.15.0
Rolesdns

Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set deps.<name> in your cluster definition. See Declaring dependencies for how required and optional dependencies work.

DependencyRequirement
prometheusOptional

Address of the Service. It must equal the kubelet’s clusterDNS, which every pod’s resolv.conf names: clusterDNS in the kubelet config (kubectl -n kube-system get cm kubelet-config -o yaml on kubeadm), --cluster-dns on k3s and RKE2. Typically 10.96.0.10 on kubeadm and 10.43.0.10 on k3s and RKE2.

  • Type: IPv4 or IPv6 address literal
  • Example: "10.96.0.10"

Extra environment variables. A value is a string, a fieldRef source such as { valueFrom.fieldRef.fieldPath = "metadata.name"; }, or a secretKeyRef source naming a Secret managed outside Kix with kix.untrackedRef. A credential that comes from a dependency is wired by the package. Null removes a variable the package sets by default.

  • Type: attribute set of (null or string or env var source with `valueFrom`)
  • Default: { }

Container image for this instance. Set it from a pin file (kix.pins) so the deployed reference is committed and resolved.

  • Type: submodule

  • Default:

    {
    digest = "sha256:0a9d8c8ddf34347eb59aad9a8784f0710de88d6d112726d11d271f9bc6daca26";
    pullPolicy = "IfNotPresent";
    repository = "docker.io/coredns/coredns";
    tag = "1.15.0";
    }

Resolved manifest digest, sha256: followed by 64 hex characters. What will actually run. Null means not resolved.

  • Type: null or string
  • Default: the package’s digest while tag is the package’s tag, otherwise null

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

  • Type: null or string
  • Default: null

Who resolved this pin, for the record. Null when unknown.

  • Type: null or string
  • Default: null

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

  • Type: null or string
  • Default: "IfNotPresent"

Image repository, registry host included.

  • Type: string
  • Default: "docker.io/coredns/coredns"

When this pin was resolved, RFC 3339. Null when unknown.

  • Type: null or string
  • Default: null

Revision of the source the image was built from, when Kix built it. Null for upstream images.

  • Type: null or string
  • Default: null

Image tag. What was asked for.

  • Type: string
  • Default: "1.15.0"

Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.

  • Type: boolean
  • Default: true

Scrape interval (e.g. ”30s”). Null = use Prometheus default.

  • Type: null or string
  • Default: null

CoreDNS replicas.

  • Type: positive integer, meaning >0
  • Default: from the availability level: 1 at none, 2 above

Container resource requests and limits. Each field keeps its default until set, and null removes a default.

  • Type: submodule

  • Default:

    {
    limits = {
    memory = "170Mi";
    };
    requests = {
    cpu = "100m";
    memory = "70Mi";
    };
    }

Dynamic resource claims the container uses. Null leaves it unset.

  • Type: null or (list of (submodule))
  • Default: null

Name of an entry in the pod’s resourceClaims.

  • Type: string

Request within the claim to use. Null uses the whole claim.

  • Type: null or string
  • Default: null

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "170Mi"

Resource quantities by name.

  • Type: open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: { }

The cpu quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "100m"

The ephemeral-storage quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: null

The memory quantity. Null leaves it unset.

  • Type: null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)
  • Default: "70Mi"

Corefile server blocks by name. Adding a block keeps default; servers.default.plugins.<p>.enabled = false removes one plugin from it, and servers.default.enabled = false removes the block. Each default directive is set field by field, so overriding kubernetes.args keeps its block.

Blocks render with those that enable view first, then by name. CoreDNS answers from the first block sharing a zone and port whose view matches, so name blocks with a prefix such as 10-office to order them.

A plugin that reads a file (file, hosts) reads it from a key added to the ConfigMap with partsOverlays on configmap, at /etc/coredns/<key>.

The package allows DNS (53) in from every pod and out to resolvers outside the cluster. Under network policy, a block on another port, an upstream that is a pod, or a DoT or DoH upstream needs a policy of its own: an entry in the cluster’s networkPolicy.platformIntents that selects these pods (k8s-app: kube-dns), or a policy resource added with partsOverlays.

  • Type: attribute set of (submodule)

  • Default:

    One block, servers.default, as kubeadm writes it:

    .:53 {
    cache 30 {
    disable success <clusterDomain>
    disable denial <clusterDomain>
    }
    errors
    forward . <cluster.network.dnsUpstream, or /etc/resolv.conf> {
    max_concurrent 1000
    }
    health {
    lameduck 5s
    }
    kubernetes <clusterDomain> in-addr.arpa ip6.arpa {
    pods insecure
    fallthrough in-addr.arpa ip6.arpa
    ttl 30
    }
    loadbalance
    loop
    prometheus :9153
    ready
    reload
    }
  • Example:

    {
    default.plugins.forward.args = [ "." "192.0.2.53" ];
    "10-office" = {
    plugins.view.args = [ "office" ];
    plugins.view.block = [ "expr incidr(client_ip(), '192.0.2.0/24')" ];
    plugins.forward.args = [ "." "192.0.2.1" ];
    };
    }

Whether the server block is rendered.

  • Type: boolean
  • Default: true

Directives of the block, keyed by a name of your choice, which is also the default plugin name. CoreDNS runs plugins in its compiled-in order whatever the Corefile says; repeats of one plugin run in attribute-name order.

  • Type: attribute set of (submodule)
  • Default: { }

Arguments after the plugin name, one word each.

  • Type: list of string
  • Default: [ ]

Lines inside the directive’s { } block. Empty renders no block.

  • Type: list of string
  • Default: [ ]

Whether the directive is rendered.

  • Type: boolean
  • Default: true

The plugin the directive runs. Set it to repeat a plugin under another attribute, for example rewrite-a = { name = "rewrite"; args = [ ... ]; }.

  • Type: string
  • Default: the attribute name

Port the block listens on, for every zone in its header.

  • Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)
  • Default: 53

Zones the block serves, such as . or example.org. The port goes in port, not in the zone. A zone with a scheme (dns://, tls://, https://, grpc://, or quic://) is refused: write a plain DNS zone without one. A TLS server needs a certificate in the pod and a Corefile block that servers does not build; add both with partsOverlays on configmap and deployment.

  • Type: non-empty (list of DNS zone name without a scheme or a :port suffix)

  • Default:

    [
    "."
    ]