---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pihole
  labels:
    app: pihole
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: pihole
  template:
    metadata:
      labels:
        app: pihole
    spec:
      containers:
      - name: pihole
        image: pihole/pihole:v5.0
        ports:
          - containerPort: 80
            name: http
            protocol: TCP
          - containerPort: 53
            name: dns
            protocol: TCP
          - containerPort: 53
            name: dns-udp
            protocol: UDP
          - containerPort:  443
            name: https
            protocol: TCP
          - containerPort: 67
            name: client-udp
            protocol: UDP
        env:
          - name: WEBPASSWORD
            valueFrom:
              secretKeyRef:
                key: "password"
                name: "pihole-secret"
          - name: DNS1
            value: 1.1.1.1
          - name: DNS2
            value: 1.0.0.1
        volumeMounts:
          - name: pihole-data
            mountPath: /etc/pihole/
      volumes:
      - name: pihole-data
        persistentVolumeClaim:
          claimName: pihole