Skip to Content
Cluster Component ManagementCoreDNSChange CoreDNS Deployment Methods

Change CoreDNS Deployment Methods

UK8S by default configures Pod anti-affinity for the CoreDNS service, requiring two service replicas to be distributed on two different nodes. This causes the cluster to only scale down to a minimum of two nodes after enabling node auto-scaling.

If you want the cluster to scale down to a single node, modify the CoreDNS deployment as follows:

  1. Execute the command: kubectl edit deploy coredns -n kube-system
  2. Replace the podAntiAffinity configuration with:
apiVersion: apps/v1 kind: Deployment metadata: name: coredns namespace: kube-system spec: template: spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: topologyKey: kubernetes.io/hostname labelSelector: matchExpressions: - key: k8s-app operator: In values: - kube-dns