Skip to content

CoreDNS

CoreDNS is cluster DNS (kube-system/kube-dns, 10.96.0.10) on every cluster. Talos installs it, not this repository: it is one of the bootstrap manifests Talos renders from cluster.coreDNS in the machine config, which only sets disabled and image. Talos runs two replicas with a preferred pod anti-affinity on kubernetes.io/hostname, which the scheduler does not have to follow.

Overview

On hetzner-mgmt, both replicas ran on worker-3 from when the cluster was built on 2026-07-02 until 2026-11-04, so one node's trouble took DNS away from every node: in the Hetzner router fault, pods on healthy nodes could not resolve *.svc.cluster.local while worker-3 was cut off.

The coredns Flux Kustomization (cluster/hetzner-mgmt/coredns/) applies components/coredns/:

Object What it adds
Deployment/coredns (partial) A required pod anti-affinity on kubernetes.io/hostname, so the two replicas cannot be scheduled on the same node. The preferred term Talos sets stays.
PodDisruptionBudget/coredns maxUnavailable: 1, so a drain evicts one replica at a time and the other keeps answering.

With four nodes and two replicas, the hard spread is always satisfiable, during a rolling update too: the surge pod goes to one of the two nodes without a replica.

The webshop cluster is single-node, so it does not get this component; wire it there once the cluster has more than one node that can run CoreDNS.

Why a Flux patch, and why it survives Talos

The Deployment is a partial manifest that Flux applies by server-side apply, as field manager kustomize-controller. It owns only the required anti-affinity and the fields the schema needs: the selector and the container name, both the same values as Talos's. Talos keeps owning the image, args and everything else, as field manager talos:

  • On boot, Talos's manifest controller only creates bootstrap objects that are missing; it never updates one that exists.
  • talosctl upgrade-k8s syncs the bootstrap manifests by server-side apply. A server-side apply changes only the fields the applier sets, so it leaves the required anti-affinity alone. (The legacy, non-server-side sync, used only when a node's Talos is too old for it, replaces the whole object. Flux then puts the anti-affinity back at its next reconcile, within 10 minutes.)

The Deployment carries kustomize.toolkit.fluxcd.io/prune: disabled, so removing the file or the Kustomization never deletes Talos's Deployment. If the Deployment is missing, Flux cannot create it from this partial manifest; Talos recreates it on the next control-plane boot or talosctl upgrade-k8s, and Flux then patches it again.

The other options were rejected:

  • Talos machine config: cluster.coreDNS has no field for affinity or topology spread.
  • Disabling Talos's CoreDNS and running it with Flux: needs a machine-config apply on every node and a cut-over of cluster DNS, for no gain over the patch.

Check

kubectl --context admin@mgmt-cluster -n kube-system get pods -l k8s-app=kube-dns -o wide   # two pods, two different nodes
kubectl --context admin@mgmt-cluster -n kube-system get deploy coredns -o jsonpath='{.spec.template.spec.affinity.podAntiAffinity}'
kubectl --context admin@mgmt-cluster -n kube-system get pdb coredns