first commit
This commit is contained in:
21
dns/README.md
Normal file
21
dns/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## Setup AdGuard Sync credentials
|
||||
```bash
|
||||
kubectl create secret generic adguardhome-password \
|
||||
--from-literal=password='your_adguardhome_password' \
|
||||
--from-literal=username='your_adguardhome_username' -n dns
|
||||
```
|
||||
|
||||
## Add AdGuardHome to CoreDNS configmap fallback:
|
||||
1. Edit the CoreDNS configmap:
|
||||
```bash
|
||||
kubectl edit configmap coredns -n kube-system
|
||||
```
|
||||
2. Replace the `forward` line with the following:
|
||||
```
|
||||
forward . <ADGUARDHOME_IP> <ADGUARDHOME_IP_2>
|
||||
```
|
||||
This will use AdGuardHome as the primary DNS server and a secondary one as a fallback, instead of using the default Kubernetes CoreDNS server.
|
||||
|
||||
You may also use `/etc/resolv.conf` to forward to the node's own DNS resolver, but it depends on whether it's well configured or not. *Since it's Linux, we never know.*
|
||||
|
||||
Ideally, since DNS is required for fetching the container image, you would have AdGuardHome as first and then a public DNS server as second (fallback).
|
118
dns/adguard-sync.yaml
Normal file
118
dns/adguard-sync.yaml
Normal file
@@ -0,0 +1,118 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: adguardsync-pvc
|
||||
namespace: dns
|
||||
annotations:
|
||||
nfs.io/storage-path: "adguardsync-config"
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Mi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: adguardsync
|
||||
namespace: dns
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: adguardsync
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: adguardsync
|
||||
spec:
|
||||
containers:
|
||||
- name: adguardsync
|
||||
image: ghcr.io/bakito/adguardhome-sync:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
protocol: TCP
|
||||
name: web-port
|
||||
env:
|
||||
- name: CRON
|
||||
value: "*/2 * * * *"
|
||||
- name: RUN_ON_START
|
||||
value: "true"
|
||||
- name: LOG_LEVEL
|
||||
value: "info"
|
||||
- name: ORIGIN_URL
|
||||
value: "http://adguard.haven"
|
||||
- name: ORIGIN_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: adguardhome-password
|
||||
key: username
|
||||
- name: ORIGIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: adguardhome-password
|
||||
key: password
|
||||
- name: REPLICA1_URL
|
||||
value: "http://adguard2.haven"
|
||||
- name: REPLICA1_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: adguardhome-password
|
||||
key: username
|
||||
- name: REPLICA1_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: adguardhome-password
|
||||
key: password
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
volumeMounts:
|
||||
- name: adguardsync-storage
|
||||
mountPath: /config
|
||||
volumes:
|
||||
- name: adguardsync-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: adguardsync-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: adguardsync-svc
|
||||
namespace: dns
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: adguardsync
|
||||
ports:
|
||||
- name: web
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: adguardsync-ingress
|
||||
namespace: dns
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: adguardsync.haven
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: adguardsync-svc
|
||||
port:
|
||||
number: 8080
|
145
dns/adguard.yaml
Normal file
145
dns/adguard.yaml
Normal file
@@ -0,0 +1,145 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: adguardhome-pvc
|
||||
namespace: dns
|
||||
annotations:
|
||||
nfs.io/storage-path: "adguardhome-config"
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: adguardhome
|
||||
namespace: dns
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: adguardhome
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: adguardhome
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- nexus
|
||||
containers:
|
||||
- name: adguardhome
|
||||
image: adguard/adguardhome:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 53
|
||||
protocol: TCP
|
||||
- containerPort: 53
|
||||
protocol: UDP
|
||||
- containerPort: 3000
|
||||
protocol: TCP
|
||||
name: install-port
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
||||
name: web-port
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: adguardhome-storage
|
||||
mountPath: /opt/adguardhome/work
|
||||
- name: adguardhome-storage
|
||||
mountPath: /opt/adguardhome/conf
|
||||
volumes:
|
||||
- name: adguardhome-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: adguardhome-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: adguardhome-svc
|
||||
namespace: dns
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: adguardhome
|
||||
loadBalancerIP: 192.168.15.200
|
||||
ports:
|
||||
- name: dns-tcp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: TCP
|
||||
- name: dns-udp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: UDP
|
||||
- name: web
|
||||
port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: adguard-install-svc
|
||||
namespace: dns
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: adguardhome
|
||||
ports:
|
||||
- name: install
|
||||
port: 3000
|
||||
targetPort: 3000
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: adguardhome-ingress
|
||||
namespace: dns
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: adguard.haven
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: adguardhome-svc
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: adguardhome-install-ingress
|
||||
namespace: dns
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: install.adguard.haven
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: adguard-install-svc
|
||||
port:
|
||||
number: 3000
|
145
dns/adguard2.yaml
Normal file
145
dns/adguard2.yaml
Normal file
@@ -0,0 +1,145 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: adguardhome2-pvc
|
||||
namespace: dns
|
||||
annotations:
|
||||
nfs.io/storage-path: "adguardhome2-config"
|
||||
spec:
|
||||
storageClassName: "nfs-client"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: adguardhome2
|
||||
namespace: dns
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: adguardhome2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: adguardhome2
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- iris
|
||||
containers:
|
||||
- name: adguardhome2
|
||||
image: adguard/adguardhome:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 53
|
||||
protocol: TCP
|
||||
- containerPort: 53
|
||||
protocol: UDP
|
||||
- containerPort: 3000
|
||||
protocol: TCP
|
||||
name: install-port
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
||||
name: web-port
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: adguardhome2-storage
|
||||
mountPath: /opt/adguardhome/work
|
||||
- name: adguardhome2-storage
|
||||
mountPath: /opt/adguardhome/conf
|
||||
volumes:
|
||||
- name: adguardhome2-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: adguardhome2-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: adguardhome2-svc
|
||||
namespace: dns
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: adguardhome2
|
||||
loadBalancerIP: 192.168.15.201
|
||||
ports:
|
||||
- name: dns-tcp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: TCP
|
||||
- name: dns-udp
|
||||
port: 53
|
||||
targetPort: 53
|
||||
protocol: UDP
|
||||
- name: web
|
||||
port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: adguard2-install-svc
|
||||
namespace: dns
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: adguardhome2
|
||||
ports:
|
||||
- name: install
|
||||
port: 3000
|
||||
targetPort: 3000
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: adguardhome2-ingress
|
||||
namespace: dns
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: adguard2.haven
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: adguardhome2-svc
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: adguardhome2-install-ingress
|
||||
namespace: dns
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: install.adguard2.haven
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: adguard2-install-svc
|
||||
port:
|
||||
number: 3000
|
Reference in New Issue
Block a user