CoreDNS

Cloudnative DNS Server

Official Documentation

Configuration

Service IP

The ip used by the cluster to query dns can be found in the kube-system namespace.

kubectl -n kube-system get cm cluster-dns -oyaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-dns
  namespace: kube-system
data:
  clusterDNS: 10.43.0.10
  clusterDomain: cluster.local

Deployment

  • Deploy 2 instances of CoreDNS.
  • Create a service account.
  • Enable pod security policy.

Others

  • Override release name to something nice.
  • Set anti affinity rules.
  • Deploy CoreDNS on control plane nodes.
  • Set tolerations to control plane taints.
  • Use priority class system-cluster-critical.

Installation

Create a file named coredns.values.yaml with the following content.

fullnameOverride: coredns

replicaCount: 2

service:
  clusterIP: 10.43.0.10

serviceAccount:
  create: true

rbac:
  pspEnable: true

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
        - key: k8s-app
          operator: In
          values:
          - coredns
      topologyKey: kubernetes.io/hostname

nodeSelector:
  node-role.kubernetes.io/control-plane: "true"

tolerations:
- key: CriticalAddonsOnly
  operator: Exists
  effect: NoExecute

priorityClassName: system-cluster-critical

Install CoreDNS with this command.

helm install --namespace kube-system --values ./coredns.values.yaml coredns coredns/coredns