apiVersion: apps/v1
kind: Deployment
metadata:
  name: pihole
  namespace: pihole
spec:
  selector:
    matchLabels:
      app: pihole
  replicas: 1 # tells deployment to run N pods matching the template
  template:
    metadata:
      labels:
        app: pihole
    spec:
      containers:
      - name: pihole
        image: pihole/pihole:latest
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 53
          name: dns
          protocol: TCP
        - containerPort: 53
          name: dns-udp
          protocol: UDP
        - containerPort: 443
          name: pihole-ssl
          protocol: TCP
        - containerPort: 67
          name: udp
          protocol: UDP
        env:
          - name: TZ
            value: "Europe/Berlin"
          - name: WEBPASSWORD
            valueFrom:
              secretKeyRef:
               name: pihole-secret
               key: PASSWORD
          - name: 'DNS1'
            value: '10.96.0.10'
          - name: 'DNS2'
            value: '8.8.8.8'
          - name: IPv6
            value: "False"
        resources:
          requests:
            memory: "512Mi"
            cpu: "500m"
          limits:
            memory: "512Mi"
            cpu: "500m"
        volumeMounts:
          - name: data
            subPath: config
            mountPath: /etc/pihole
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: pihole-data