|
| 1 | +apiVersion: v1 |
| 2 | +kind: ServiceAccount |
| 3 | +metadata: |
| 4 | + name: coredns |
| 5 | + namespace: kube-system |
| 6 | +--- |
| 7 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 8 | +kind: ClusterRole |
| 9 | +metadata: |
| 10 | + labels: |
| 11 | + kubernetes.io/bootstrapping: rbac-defaults |
| 12 | + name: system:coredns |
| 13 | +rules: |
| 14 | +- apiGroups: |
| 15 | + - "" |
| 16 | + resources: |
| 17 | + - endpoints |
| 18 | + - services |
| 19 | + - pods |
| 20 | + - namespaces |
| 21 | + verbs: |
| 22 | + - list |
| 23 | + - watch |
| 24 | +- apiGroups: |
| 25 | + - "" |
| 26 | + resources: |
| 27 | + - nodes |
| 28 | + verbs: |
| 29 | + - get |
| 30 | +- apiGroups: |
| 31 | + - discovery.k8s.io |
| 32 | + resources: |
| 33 | + - endpointslices |
| 34 | + verbs: |
| 35 | + - list |
| 36 | + - watch |
| 37 | +--- |
| 38 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 39 | +kind: ClusterRoleBinding |
| 40 | +metadata: |
| 41 | + annotations: |
| 42 | + rbac.authorization.kubernetes.io/autoupdate: "true" |
| 43 | + labels: |
| 44 | + kubernetes.io/bootstrapping: rbac-defaults |
| 45 | + name: system:coredns |
| 46 | +roleRef: |
| 47 | + apiGroup: rbac.authorization.k8s.io |
| 48 | + kind: ClusterRole |
| 49 | + name: system:coredns |
| 50 | +subjects: |
| 51 | +- kind: ServiceAccount |
| 52 | + name: coredns |
| 53 | + namespace: kube-system |
| 54 | +--- |
| 55 | +apiVersion: v1 |
| 56 | +kind: ConfigMap |
| 57 | +metadata: |
| 58 | + name: coredns |
| 59 | + namespace: kube-system |
| 60 | +data: |
| 61 | + Corefile: | |
| 62 | + .:53 { |
| 63 | + errors |
| 64 | + health |
| 65 | + ready |
| 66 | + kubernetes cluster.local in-addr.arpa ip6.arpa { |
| 67 | + pods insecure |
| 68 | + fallthrough in-addr.arpa ip6.arpa |
| 69 | + } |
| 70 | + prometheus :9153 |
| 71 | + cache 30 |
| 72 | + loop |
| 73 | + reload |
| 74 | + loadbalance |
| 75 | + } |
| 76 | +--- |
| 77 | +apiVersion: apps/v1 |
| 78 | +kind: Deployment |
| 79 | +metadata: |
| 80 | + name: coredns |
| 81 | + namespace: kube-system |
| 82 | + labels: |
| 83 | + k8s-app: kube-dns |
| 84 | + kubernetes.io/name: "CoreDNS" |
| 85 | +spec: |
| 86 | + replicas: {{ .Values.coredns.replicaCount }} |
| 87 | + strategy: |
| 88 | + type: RollingUpdate |
| 89 | + rollingUpdate: |
| 90 | + maxUnavailable: 1 |
| 91 | + selector: |
| 92 | + matchLabels: |
| 93 | + k8s-app: kube-dns |
| 94 | + template: |
| 95 | + metadata: |
| 96 | + labels: |
| 97 | + k8s-app: kube-dns |
| 98 | + spec: |
| 99 | + priorityClassName: system-cluster-critical |
| 100 | + serviceAccountName: coredns |
| 101 | + tolerations: |
| 102 | + - key: "CriticalAddonsOnly" |
| 103 | + operator: "Exists" |
| 104 | + nodeSelector: |
| 105 | + beta.kubernetes.io/os: linux |
| 106 | + {{- with .Values.coredns.image.pullSecrets }} |
| 107 | + imagePullSecrets: |
| 108 | + {{- toYaml . | nindent 10 }} |
| 109 | + {{- end }} |
| 110 | + containers: |
| 111 | + - name: coredns |
| 112 | + {{- with .Values.coredns.image }} |
| 113 | + image: "{{ .repository }}{{ if .digest }}@{{ .digest }}{{ else }}:{{ .tag }}{{ end }}" |
| 114 | + imagePullPolicy: {{ .pullPolicy }} |
| 115 | + {{- end }} |
| 116 | + resources: |
| 117 | + {{- toYaml .Values.coredns.resources | nindent 10 }} |
| 118 | + args: [ "-conf", "/etc/coredns/Corefile" ] |
| 119 | + volumeMounts: |
| 120 | + - name: config-volume |
| 121 | + mountPath: /etc/coredns |
| 122 | + readOnly: true |
| 123 | + ports: |
| 124 | + - containerPort: 53 |
| 125 | + name: dns |
| 126 | + protocol: UDP |
| 127 | + - containerPort: 53 |
| 128 | + name: dns-tcp |
| 129 | + protocol: TCP |
| 130 | + - containerPort: 9153 |
| 131 | + name: metrics |
| 132 | + protocol: TCP |
| 133 | + securityContext: |
| 134 | + allowPrivilegeEscalation: false |
| 135 | + capabilities: |
| 136 | + add: |
| 137 | + - NET_BIND_SERVICE |
| 138 | + drop: |
| 139 | + - all |
| 140 | + readOnlyRootFilesystem: true |
| 141 | + livenessProbe: |
| 142 | + httpGet: |
| 143 | + path: /health |
| 144 | + port: 8080 |
| 145 | + scheme: HTTP |
| 146 | + initialDelaySeconds: 60 |
| 147 | + timeoutSeconds: 5 |
| 148 | + successThreshold: 1 |
| 149 | + failureThreshold: 5 |
| 150 | + readinessProbe: |
| 151 | + httpGet: |
| 152 | + path: /ready |
| 153 | + port: 8181 |
| 154 | + scheme: HTTP |
| 155 | + dnsPolicy: Default |
| 156 | + volumes: |
| 157 | + - name: config-volume |
| 158 | + configMap: |
| 159 | + name: coredns |
| 160 | + items: |
| 161 | + - key: Corefile |
| 162 | + path: Corefile |
| 163 | +--- |
| 164 | +apiVersion: v1 |
| 165 | +kind: Service |
| 166 | +metadata: |
| 167 | + name: kube-dns |
| 168 | + namespace: kube-system |
| 169 | + annotations: |
| 170 | + prometheus.io/port: "9153" |
| 171 | + prometheus.io/scrape: "true" |
| 172 | + labels: |
| 173 | + k8s-app: kube-dns |
| 174 | + kubernetes.io/cluster-service: "true" |
| 175 | + kubernetes.io/name: "CoreDNS" |
| 176 | +spec: |
| 177 | + selector: |
| 178 | + k8s-app: kube-dns |
| 179 | + clusterIP: {{ template "getCoreDNS" . }} |
| 180 | + ports: |
| 181 | + - name: dns |
| 182 | + port: 53 |
| 183 | + protocol: UDP |
| 184 | + - name: dns-tcp |
| 185 | + port: 53 |
| 186 | + protocol: TCP |
| 187 | + - name: metrics |
| 188 | + port: 9153 |
| 189 | + protocol: TCP |
0 commit comments