CoreDNS
Cloudnative DNS Server
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
Helm Values
service:
clusterIP: 10.43.0.10
Deployment
- Deploy 2 instances of CoreDNS.
- Create a service account.
- Enable pod security policy.
Helm Values
replicaCount: 2
serviceAccount:
create: true
rbac:
pspEnable: true
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
.
Helm Values
fullnameOverride: coredns
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
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