From 9a645ba86debbb6a03ce023ab5e2d9070d4ebac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BENEDEK=20L=C3=A1szl=C3=B3?= Date: Sat, 3 May 2025 02:33:15 +0200 Subject: [PATCH] coredns --- k8s/coredns/coredns.yml | 126 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 k8s/coredns/coredns.yml diff --git a/k8s/coredns/coredns.yml b/k8s/coredns/coredns.yml new file mode 100644 index 0000000..87a20c3 --- /dev/null +++ b/k8s/coredns/coredns.yml @@ -0,0 +1,126 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: dns + +--- +kind: ConfigMap +apiVersion: v1 +metadata: + name: config + namespace: dns +data: + Corefile: |- + .:53 { + log + errors + file /config/db.cluster + } + + db.cluster: |- + $TTL 1m + $ORIGIN cluster. + @ IN SOA cluster. lacbenedek.gmail.com. ( + 2025050202 ; serial + 1m ; period + 1m ; retry + 1m ; exp + 1m ; ttl + ) + cluster. IN A 192.168.123.240 + cluster. IN TXT "example txt section in dns" + control.cluster. IN A 192.168.123.1 + +--- + +kind: Deployment +apiVersion: apps/v1 +metadata: + name: coredns + namespace: dns +spec: + replicas: 1 + selector: + matchLabels: + app: coredns + template: + metadata: + labels: + app: coredns + spec: + containers: + - name: coredns + image: coredns/coredns + ports: + - containerPort: 53 + protocol: UDP + - containerPort: 53 + protocol: TCP + args: + - -conf=/config/Corefile + volumeMounts: + - mountPath: /config + name: config + readOnly: true + resources: + limits: + cpu: '1000m' + memory: '500Mi' + requests: + cpu: '10m' + memory: '10Mi' + volumes: + - name: config + configMap: + name: config + +--- + +kind: Service +apiVersion: v1 +metadata: + name: dns + namespace: dns +spec: + ports: + - port: 53 + targetPort: 53 + protocol: UDP + name: dns + - port: 53 + targetPort: 53 + protocol: TCP + name: dns-tcp + selector: + app: coredns + +--- + +apiVersion: traefik.io/v1alpha1 +kind: IngressRouteUDP +metadata: + name: dns + namespace: dns +spec: + entryPoints: + - dns + routes: + - services: + - name: dns + port: 53 + +--- + +apiVersion: traefik.io/v1alpha1 +kind: IngressRouteTCP +metadata: + name: dnstcp + namespace: dns +spec: + entryPoints: + - dnstcp + routes: + - match: HostSNI('*') + services: + - name: dns + port: 53