Pi-hole on Kubernetes

How to install Pi-hole on kubernetes.

The ad-blocker for your network. Change the DNS on your router to ip of your Kubernetes cluster. You can also make the DNS change on your computer – if you not like to change the DNS for all devices on your router.

Not all devices support DNS change like mobile phones or smart home devices.

kubectl create ns pihole
helm install pihole mojo2600/pihole -f pihole.yaml --namespace pihole

Here you have the pihole.yaml file for the installation.

replicaCount: 1

dnsmasq:
  customDnsEntries:
  # Add custom DNS records in
  # dnsmasq-installation of Pi-Hole
  - address=/pihole.local/192.168.0.220

persistentVolumeClaim:
  enabled: true

serviceWeb:
  http:
    enabled: true
    port: 5080

  https:
    enabled: true
    port: 5443

  #type: ClusterIP

  # The static LoadBalancer IP address for serviceWeb and
  # serviceDns does not have to be set, since the pool "pihole"
  # in metallb will only contain a single IP address that can
  # be allocated when using the address-pool "pihole".
  annotations:
    # Ensures that the pihole receives IP address from
    # predefined pool in metallb
    metallb.universe.tf/address-pool: pihole
    # This ensures that port 53 for TCP and UDP is colocated
    # on the same IP address.
    metallb.universe.tf/allow-shared-ip: pihole-svc
  type: LoadBalancer

serviceDns:
  annotations:
    # Ensures that the pihole receives IP address from
    # predefined pool in metallb
    metallb.universe.tf/address-pool: pihole
    # This ensures that port 53 for TCP and UDP is colocated
    # on the same IP address.
    metallb.universe.tf/allow-shared-ip: pihole-svc
  type: LoadBalancer

So this is at fast and secure way to get ad-blocker installed for all devices on your home network.

If you not have done this I think uBlock Origin is also a must have on every internet browser.

Pi-hole is a good and free tool for blocking virus and ads. But for Youtube you need uBlock otherwise you will have ads.

Pi-hole can also be managed on your iPhone or Android phone.

Remember to use persistent storage on every importend application otherwise your data will go lost on reboot or update. Here a short look from Portainer.

To uninstall Pi-hole on your kubernetes cluster you can use this command.

helm delete pihole --namespace pihole

Pi-hole is super ;O)

Leave a comment

Your email address will not be published.