1.Create NFS share
2. pi-hole-deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pi-hole-deployment
spec:
replicas: 1
selector:
matchLabels:
app: pi-hole
template:
metadata:
name: pi-hole-deployment
labels:
app: pi-hole
env: prod
spec:
containers:
- name: pi-hole
image: pihole/pihole
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "256Mi"
cpu: "200m"
limits:
memory: "512Mi"
cpu: "200m"
volumeMounts:
- name: pihole-nfs
mountPath: /etc/pihole
- name: dnsmasq-nfs
mountPath: /etc/dnsmasq.d
ports:
- name: tcp-port
containerPort: 53
protocol: TCP
- name: udp-port
containerPort: 53
protocol: UDP
- name: http-port
containerPort: 80
- name: https-port
containerPort: 443
volumes:
- name: pihole-nfs
nfs:
server: 192.168.0.184
path: "/opt/nfs1/pihole/pihole"
- name: dnsmasq-nfs
nfs:
server: 192.168.0.184
path: "/opt/nfs1/pihole/dnsmasq.d"
---
apiVersion: v1
kind: Service
metadata:
name: pi-hole-service
labels:
app: pi-hole
env: prod
spec:
selector:
app: pi-hole
type: NodePort
externalIPs:
- 192.168.0.183
ports:
- name: dns-tcp
port: 53
targetPort: 53
nodePort: 30053
protocol: TCP
- name: dns-udp
port: 53
targetPort: 53
nodePort: 30053
protocol: UDP
- name: http
port: 800
targetPort: 80
nodePort: 30054
- name: https
port: 801
targetPort: 443
nodePort: 30055
Note: Use externalIPs in service so that the IP can be put inside wifi DNS.