|
| 1 | +# Copyright (c) 2022 Gitpod GmbH. All rights reserved. |
| 2 | +# Licensed under the MIT License. See License-MIT.txt in the project root for license information. |
| 3 | + |
| 4 | +apiVersion: v1 |
| 5 | +kind: ServiceAccount |
| 6 | +metadata: |
| 7 | + name: coredns |
| 8 | + namespace: kube-system |
| 9 | +--- |
| 10 | +apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 11 | +kind: ClusterRole |
| 12 | +metadata: |
| 13 | + labels: |
| 14 | + kubernetes.io/bootstrapping: rbac-defaults |
| 15 | + name: system:coredns |
| 16 | +rules: |
| 17 | +- apiGroups: |
| 18 | + - "" |
| 19 | + resources: |
| 20 | + - endpoints |
| 21 | + - services |
| 22 | + - pods |
| 23 | + - namespaces |
| 24 | + verbs: |
| 25 | + - list |
| 26 | + - watch |
| 27 | +- apiGroups: |
| 28 | + - discovery.k8s.io |
| 29 | + resources: |
| 30 | + - endpointslices |
| 31 | + verbs: |
| 32 | + - list |
| 33 | + - watch |
| 34 | +--- |
| 35 | +apiVersion: rbac.authorization.k8s.io/v1beta1 |
| 36 | +kind: ClusterRoleBinding |
| 37 | +metadata: |
| 38 | + annotations: |
| 39 | + rbac.authorization.kubernetes.io/autoupdate: "true" |
| 40 | + labels: |
| 41 | + kubernetes.io/bootstrapping: rbac-defaults |
| 42 | + name: system:coredns |
| 43 | +roleRef: |
| 44 | + apiGroup: rbac.authorization.k8s.io |
| 45 | + kind: ClusterRole |
| 46 | + name: system:coredns |
| 47 | +subjects: |
| 48 | +- kind: ServiceAccount |
| 49 | + name: coredns |
| 50 | + namespace: kube-system |
| 51 | +--- |
| 52 | +apiVersion: v1 |
| 53 | +kind: ConfigMap |
| 54 | +metadata: |
| 55 | + name: coredns |
| 56 | + namespace: kube-system |
| 57 | +data: |
| 58 | + gitpod.db: | |
| 59 | + ; 127-0-0-1.nip.io test file |
| 60 | + 127-0-0-1.nip.io. IN SOA sns.dns.icann.org. noc.dns.icann.org. 2015082541 7200 3600 1209600 3600 |
| 61 | + 127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local. |
| 62 | + *.127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local. |
| 63 | + *.ws.127-0-0-1.nip.io. IN CNAME proxy.default.svc.cluster.local. |
| 64 | + Corefile: | |
| 65 | + .:53 { |
| 66 | + errors |
| 67 | + health |
| 68 | + ready |
| 69 | + # extra configuration for `127-0-0-1.nip.io` |
| 70 | + file /etc/coredns/gitpod.db 127-0-0-1.nip.io |
| 71 | + kubernetes cluster.local in-addr.arpa ip6.arpa { |
| 72 | + pods insecure |
| 73 | + fallthrough in-addr.arpa ip6.arpa |
| 74 | + } |
| 75 | + hosts /etc/coredns/NodeHosts { |
| 76 | + ttl 60 |
| 77 | + reload 15s |
| 78 | + fallthrough |
| 79 | + } |
| 80 | + prometheus :9153 |
| 81 | + forward . /etc/resolv.conf |
| 82 | + cache 30 |
| 83 | + loop |
| 84 | + reload |
| 85 | + loadbalance |
| 86 | + } |
| 87 | +--- |
| 88 | +apiVersion: apps/v1 |
| 89 | +kind: Deployment |
| 90 | +metadata: |
| 91 | + name: coredns |
| 92 | + namespace: kube-system |
| 93 | + labels: |
| 94 | + k8s-app: kube-dns |
| 95 | + kubernetes.io/name: "CoreDNS" |
| 96 | +spec: |
| 97 | + #replicas: 1 |
| 98 | + strategy: |
| 99 | + type: RollingUpdate |
| 100 | + rollingUpdate: |
| 101 | + maxUnavailable: 1 |
| 102 | + selector: |
| 103 | + matchLabels: |
| 104 | + k8s-app: kube-dns |
| 105 | + template: |
| 106 | + metadata: |
| 107 | + labels: |
| 108 | + k8s-app: kube-dns |
| 109 | + spec: |
| 110 | + priorityClassName: "system-cluster-critical" |
| 111 | + serviceAccountName: coredns |
| 112 | + tolerations: |
| 113 | + - key: "CriticalAddonsOnly" |
| 114 | + operator: "Exists" |
| 115 | + - key: "node-role.kubernetes.io/control-plane" |
| 116 | + operator: "Exists" |
| 117 | + effect: "NoSchedule" |
| 118 | + - key: "node-role.kubernetes.io/master" |
| 119 | + operator: "Exists" |
| 120 | + effect: "NoSchedule" |
| 121 | + nodeSelector: |
| 122 | + beta.kubernetes.io/os: linux |
| 123 | + containers: |
| 124 | + - name: coredns |
| 125 | + image: rancher/mirrored-coredns-coredns:1.9.1 |
| 126 | + imagePullPolicy: IfNotPresent |
| 127 | + resources: |
| 128 | + limits: |
| 129 | + memory: 170Mi |
| 130 | + requests: |
| 131 | + cpu: 100m |
| 132 | + memory: 70Mi |
| 133 | + args: [ "-conf", "/etc/coredns/Corefile" ] |
| 134 | + volumeMounts: |
| 135 | + - name: config-volume |
| 136 | + mountPath: /etc/coredns |
| 137 | + readOnly: true |
| 138 | + ports: |
| 139 | + - containerPort: 53 |
| 140 | + name: dns |
| 141 | + protocol: UDP |
| 142 | + - containerPort: 53 |
| 143 | + name: dns-tcp |
| 144 | + protocol: TCP |
| 145 | + - containerPort: 9153 |
| 146 | + name: metrics |
| 147 | + protocol: TCP |
| 148 | + securityContext: |
| 149 | + allowPrivilegeEscalation: false |
| 150 | + capabilities: |
| 151 | + add: |
| 152 | + - NET_BIND_SERVICE |
| 153 | + drop: |
| 154 | + - all |
| 155 | + readOnlyRootFilesystem: true |
| 156 | + livenessProbe: |
| 157 | + httpGet: |
| 158 | + path: /health |
| 159 | + port: 8080 |
| 160 | + scheme: HTTP |
| 161 | + initialDelaySeconds: 60 |
| 162 | + periodSeconds: 10 |
| 163 | + timeoutSeconds: 1 |
| 164 | + successThreshold: 1 |
| 165 | + failureThreshold: 3 |
| 166 | + readinessProbe: |
| 167 | + httpGet: |
| 168 | + path: /ready |
| 169 | + port: 8181 |
| 170 | + scheme: HTTP |
| 171 | + initialDelaySeconds: 0 |
| 172 | + periodSeconds: 2 |
| 173 | + timeoutSeconds: 1 |
| 174 | + successThreshold: 1 |
| 175 | + failureThreshold: 3 |
| 176 | + dnsPolicy: Default |
| 177 | + volumes: |
| 178 | + - name: config-volume |
| 179 | + configMap: |
| 180 | + name: coredns |
| 181 | + items: |
| 182 | + - key: gitpod.db |
| 183 | + path: gitpod.db |
| 184 | + - key: Corefile |
| 185 | + path: Corefile |
| 186 | + - key: NodeHosts |
| 187 | + path: NodeHosts |
| 188 | +--- |
| 189 | +apiVersion: v1 |
| 190 | +kind: Service |
| 191 | +metadata: |
| 192 | + name: kube-dns |
| 193 | + namespace: kube-system |
| 194 | + annotations: |
| 195 | + prometheus.io/port: "9153" |
| 196 | + prometheus.io/scrape: "true" |
| 197 | + labels: |
| 198 | + k8s-app: kube-dns |
| 199 | + kubernetes.io/cluster-service: "true" |
| 200 | + kubernetes.io/name: "CoreDNS" |
| 201 | +spec: |
| 202 | + selector: |
| 203 | + k8s-app: kube-dns |
| 204 | + clusterIP: 10.43.0.10 |
| 205 | + ports: |
| 206 | + - name: dns |
| 207 | + port: 53 |
| 208 | + protocol: UDP |
| 209 | + - name: dns-tcp |
| 210 | + port: 53 |
| 211 | + protocol: TCP |
| 212 | + - name: metrics |
| 213 | + port: 9153 |
| 214 | + protocol: TCP |
0 commit comments