I installed fresh kubernetes single node cluster and I see 2 coredns pods running. One of them is failing (not part of this question)
Why they are 2 of them?
I installed fresh kubernetes single node cluster and I see 2 coredns pods running. One of them is failing (not part of this question)
Why they are 2 of them?
Detailed tuning info for CoreDNS's on this link.
CoreDNS memory usage is predominantly affected by the number of Pods and Services in the cluster. Other factors include the size of the filled DNS answer cache, and the rate of queries received (QPS) per CoreDNS instance.
Two Replicas are for high availability (reduce the risk of CoreDNS downtime) and default value at install time.
You can change this by scaling down/up the deployment for coredns on your deployment.
Default
$ kubectl describe deployment.apps -n kube-system coredns
Name: coredns
Namespace: kube-system
CreationTimestamp: Tue, 03 Mar 2020 09:28:50 +0000
Labels: k8s-app=kube-dns
Annotations: deployment.kubernetes.io/revision: 1
Selector: k8s-app=kube-dns
Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 1 max unavailable, 25% max surge
Scale Down to 1
$ kubectl scale deployments.apps -n kube-system coredns --replicas=1
deployment.apps/coredns scaled
$ kubectl describe deployment.apps -n kube-system coredns
Name: coredns
Namespace: kube-system
CreationTimestamp: Tue, 03 Mar 2020 09:28:50 +0000
Labels: k8s-app=kube-dns
Annotations: deployment.kubernetes.io/revision: 1
Selector: k8s-app=kube-dns
Replicas: 1 desired | 1 updated | 1 total | 1 available | 0 unavailable
Scale Up to 3
$ kubectl scale deployments.apps -n kube-system coredns --replicas=3
deployment.apps/coredns scaled
$ kubectl describe deployment.apps -n kube-system coredns
Name: coredns
Namespace: kube-system
CreationTimestamp: Tue, 03 Mar 2020 09:28:50 +0000
Labels: k8s-app=kube-dns
Annotations: deployment.kubernetes.io/revision: 1
Selector: k8s-app=kube-dns
Replicas: 3 desired | 3 updated | 3 total | 2 available | 1 unavailable
Two pods exist for resilience.
You can always configure the number of replicas by editing the deployment in kube-system
© 2022 - 2024 — McMap. All rights reserved.