From 78defa04232c1881cbf4ef8aa10e1fc3c24a762a Mon Sep 17 00:00:00 2001 From: Story Crater Bot <19826264+Riotpiaole@users.noreply.github.com> Date: Mon, 13 Jul 2026 16:51:49 -0700 Subject: [PATCH] feat: track full CoreDNS Deployment manifest, add topologySpreadConstraints CoreDNS is Talos-bootstrapped and previously untracked except for its ConfigMap. Pull the full live spec into one file as the single source of truth, add topologySpreadConstraints so the 2 replicas don't land on the same node. ScheduleAnyway (not DoNotSchedule) to avoid blocking scheduling if a node is briefly unavailable. --- helmfile.yaml.gotmpl | 1 + k8s/coredns/coredns-deployment.yaml | 130 ++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 k8s/coredns/coredns-deployment.yaml diff --git a/helmfile.yaml.gotmpl b/helmfile.yaml.gotmpl index 9ed516d..6f8d4ef 100644 --- a/helmfile.yaml.gotmpl +++ b/helmfile.yaml.gotmpl @@ -160,6 +160,7 @@ releases: # otherwise services stay . Apply it here as the first hook. kubectl apply -f k8s/cilium/lb-ipam-pool.yaml kubectl apply -f k8s/coredns/coredns-configmap.yaml + kubectl apply -f k8s/coredns/coredns-deployment.yaml kubectl rollout restart deployment/coredns -n kube-system kubectl rollout status deployment/coredns -n kube-system --timeout=60s # Wildcard TLS cert — must exist before nginx starts so it can read the secret. diff --git a/k8s/coredns/coredns-deployment.yaml b/k8s/coredns/coredns-deployment.yaml new file mode 100644 index 0000000..004ca27 --- /dev/null +++ b/k8s/coredns/coredns-deployment.yaml @@ -0,0 +1,130 @@ +# CoreDNS is deployed by Talos's bootstrap manifests (not a helm release we +# own). This tracks the full Deployment spec as the single source of truth +# for any changes we apply on top of the Talos default — currently just +# topologySpreadConstraints so the 2 replicas don't land on the same node. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coredns + namespace: kube-system + labels: + k8s-app: kube-dns + kubernetes.io/name: CoreDNS +spec: + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + k8s-app: kube-dns + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + k8s-app: kube-dns + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: k8s-app + operator: In + values: + - kube-dns + topologyKey: kubernetes.io/hostname + weight: 100 + containers: + - args: + - -conf + - /etc/coredns/Corefile + env: + - name: GOMEMLIMIT + value: 161MiB + image: registry.k8s.io/coredns/coredns:v1.14.2 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 5 + httpGet: + path: /health + port: 8080 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: coredns + ports: + - containerPort: 53 + name: dns + protocol: UDP + - containerPort: 53 + name: dns-tcp + protocol: TCP + - containerPort: 9153 + name: metrics + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /ready + port: 8181 + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + memory: 170Mi + requests: + cpu: 100m + memory: 70Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + add: + - NET_BIND_SERVICE + drop: + - ALL + readOnlyRootFilesystem: true + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/coredns + name: config-volume + readOnly: true + dnsPolicy: Default + nodeSelector: + kubernetes.io/os: linux + priorityClassName: system-cluster-critical + restartPolicy: Always + schedulerName: default-scheduler + serviceAccount: coredns + serviceAccountName: coredns + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane + operator: Exists + - effect: NoSchedule + key: node.cloudprovider.kubernetes.io/uninitialized + operator: Exists + topologySpreadConstraints: + - labelSelector: + matchLabels: + k8s-app: kube-dns + maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: ScheduleAnyway + volumes: + - configMap: + defaultMode: 420 + items: + - key: Corefile + path: Corefile + name: coredns + name: config-volume