cluster-configs/k8s/coredns/coredns.yml
2025-05-03 02:33:15 +02:00

127 lines
2.1 KiB
YAML

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