apiVersion: apps/v1 kind: Deployment metadata: name: adguard namespace: dns labels: app: adguard spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: adguard template: metadata: labels: app: adguard spec: hostNetwork: true dnsPolicy: ClusterFirstWithHostNet initContainers: - name: fix-bind-hosts image: python:3.12-alpine command: ["python3", "-c"] args: - | import re, os config = "/opt/adguardhome/conf/AdGuardHome.yaml" if os.path.exists(config): with open(config) as f: content = f.read() content = re.sub( r'(bind_hosts:\n)((?:[ \t]*- .*\n)*)', 'bind_hosts:\n - 0.0.0.0\n', content ) with open(config, "w") as f: f.write(content) print("bind_hosts set to 0.0.0.0") else: print("No config yet — AdGuard will create it on first run") volumeMounts: - name: config mountPath: /opt/adguardhome/conf containers: - name: adguard image: adguard/adguardhome:latest ports: - name: dns-tcp containerPort: 53 protocol: TCP - name: dns-udp containerPort: 53 protocol: UDP - name: http containerPort: 3000 protocol: TCP volumeMounts: - name: config mountPath: /opt/adguardhome/conf - name: data mountPath: /opt/adguardhome/work resources: requests: memory: 128Mi cpu: 100m limits: memory: 512Mi cpu: 500m volumes: - name: config persistentVolumeClaim: claimName: adguard-config - name: data persistentVolumeClaim: claimName: adguard-data --- apiVersion: v1 kind: Service metadata: name: adguard-ui namespace: dns spec: selector: app: adguard ports: - name: http port: 3000 targetPort: 3000 type: ClusterIP