Remove slave. Convert dep to ds

This commit is contained in:
j 2025-07-01 22:23:31 +10:00
parent 077cf9bbd4
commit 6ea2f60580

View file

@ -11,12 +11,7 @@ metadata:
namespace: dns namespace: dns
data: data:
named.conf: | named.conf: |
acl "slaves" {
10.42.0.0/16;
};
include "/etc/bind/externaldns-key.conf"; include "/etc/bind/externaldns-key.conf";
include "/etc/bind/tsig-key.conf";
options { options {
directory "/var/cache/bind"; directory "/var/cache/bind";
@ -31,8 +26,6 @@ data:
10.40.0.254; 10.40.0.254;
}; };
allow-transfer { "slaves"; };
dnssec-validation auto; dnssec-validation auto;
}; };
@ -45,7 +38,6 @@ data:
type master; type master;
file "/etc/bind/db.hxme.net"; file "/etc/bind/db.hxme.net";
allow-update { key "externaldns-key"; }; allow-update { key "externaldns-key"; };
allow-transfer { key "bind-slave-key"; };
}; };
db.hxme.net: | db.hxme.net: |
$TTL 3600 $TTL 3600
@ -61,41 +53,12 @@ data:
@ IN A 10.40.0.110 @ IN A 10.40.0.110
www IN A 10.40.0.110 www IN A 10.40.0.110
--- ---
apiVersion: v1
kind: ConfigMap
metadata:
name: bind-slave-config
namespace: dns
data:
named.conf: |
options {
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
dnssec-validation auto;
};
include "/etc/bind/tsig-key.conf";
masters "hxme-master" {
bind-master.dns.svc.cluster.local key "bind-slave-key";
};
zone "hxme.net" {
type slave;
masters { "hxme-master"; };
file "slaves/db.hxme.net";
};
---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: DaemonSet
metadata: metadata:
name: bind-master name: bind-master
namespace: dns namespace: dns
spec: spec:
replicas: 1
selector: selector:
matchLabels: matchLabels:
app: bind-master app: bind-master
@ -104,8 +67,10 @@ spec:
labels: labels:
app: bind-master app: bind-master
spec: spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
securityContext: securityContext:
fsGroup: 999 # allow group access to volumes for named user fsGroup: 999
initContainers: initContainers:
- name: fetch-root-hints - name: fetch-root-hints
image: debian:12 image: debian:12
@ -115,8 +80,6 @@ spec:
- | - |
apt update && apt -y install curl apt update && apt -y install curl
curl -sfSL https://www.internic.net/domain/named.cache -o /usr/share/dns/root.hints curl -sfSL https://www.internic.net/domain/named.cache -o /usr/share/dns/root.hints
# Uncomment below to hold the container open for debugging:
# tail -f /dev/null
volumeMounts: volumeMounts:
- mountPath: /usr/share/dns - mountPath: /usr/share/dns
name: root-hints name: root-hints
@ -125,29 +88,26 @@ spec:
image: internetsystemsconsortium/bind9:9.18 image: internetsystemsconsortium/bind9:9.18
command: ["named", "-g", "-c", "/etc/bind/named.conf"] command: ["named", "-g", "-c", "/etc/bind/named.conf"]
ports: ports:
- containerPort: 53 - containerPort: 53
protocol: UDP protocol: UDP
- containerPort: 53 - containerPort: 53
protocol: TCP protocol: TCP
volumeMounts: volumeMounts:
- name: config - name: config
mountPath: /etc/bind/named.conf mountPath: /etc/bind/named.conf
subPath: named.conf subPath: named.conf
- name: config - name: config
mountPath: /etc/bind/db.hxme.net mountPath: /etc/bind/db.hxme.net
subPath: db.hxme.net subPath: db.hxme.net
- name: dns-secrets - name: dns-secrets
mountPath: /etc/bind/externaldns-key.conf mountPath: /etc/bind/externaldns-key.conf
subPath: externaldns-key.conf subPath: externaldns-key.conf
- name: dns-secrets - name: bind-cache
subPath: tsig-key.conf mountPath: /var/cache/bind
mountPath: /etc/bind/tsig-key.conf - name: bind-rundir
- name: bind-cache mountPath: /var/run/named
mountPath: /var/cache/bind - name: root-hints
- name: bind-rundir mountPath: /usr/share/dns
mountPath: /var/run/named
- name: root-hints
mountPath: /usr/share/dns
volumes: volumes:
- name: dns-secrets - name: dns-secrets
secret: secret:
@ -161,88 +121,4 @@ spec:
emptyDir: {} emptyDir: {}
- name: root-hints - name: root-hints
emptyDir: {} emptyDir: {}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: bind-slave
namespace: dns
spec:
selector:
matchLabels:
app: bind-slave
template:
metadata:
labels:
app: bind-slave
spec:
securityContext:
fsGroup: 999
containers:
- name: bind9
image: internetsystemsconsortium/bind9:9.18
command: ["named", "-g", "-c", "/etc/bind/named.conf"]
ports:
- containerPort: 53
protocol: UDP
- containerPort: 53
protocol: TCP
volumeMounts:
- name: config
mountPath: /etc/bind/named.conf
subPath: named.conf
- name: dns-secrets
subPath: tsig-key.conf
mountPath: /etc/bind/tsig-key.conf
- name: bind-cache
mountPath: /var/cache/bind
- name: bind-rundir
mountPath: /var/run/named
volumes:
- name: config
configMap:
name: bind-slave-config
- name: dns-secrets
secret:
secretName: dns-secrets
- name: bind-cache
emptyDir: {}
- name: bind-rundir
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: bind-slave
namespace: dns
spec:
type: LoadBalancer
selector:
app: bind-slave
ports:
- name: dns-udp
port: 53
targetPort: 53
protocol: UDP
- name: dns-tcp
port: 53
targetPort: 53
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: bind-master
namespace: dns
spec:
type: ClusterIP
selector:
app: bind-master
ports:
- name: dns-udp
port: 53
protocol: UDP
- name: dns-tcp
port: 53
protocol: TCP