pihole

by MoJo2600

Helm chartv3.0.0-rc.4App 2026.11.0Verified publisher

Installs pihole in kubernetes

About this chart

pihole

Installs pihole in kubernetes

Source Code

Requirements

Kubernetes: >=1.26.0-0

Introduction

Pi-hole® is a network-wide ad blocker that acts as a DNS sinkhole. This chart deploys Pi-hole (v6) on Kubernetes as a Deployment, with separate services for the web interface, DNS (TCP/UDP) and optional DHCP, plus optional encrypted upstream DNS, persistence, Prometheus monitoring and network policies.

Note: Pi-hole v6 is configured through FTLCONF_* environment variables, which you pass via extraEnvVars. See the Pi-hole v6 configuration docs for the full list of settings.

Table of Contents

  • Introduction
  • Prerequisites
  • Quick Start
  • Installation
  • Configuration
    • Exposing Pi-hole
      • Making DNS reachable on port 53
    • Example values.yaml
    • Admin password
    • Upstream DNS resolvers
    • Local DNS records
    • Encrypted upstream DNS (DoH / DoT / DNSCrypt)
    • Monitoring
    • Persistence
    • NetworkPolicy
    • ServiceAccount
    • Security context (experimental)
    • Health probes
    • Upgrades without downtime
    • High availability
  • Troubleshooting
    • Pi-hole does not start with hostNetwork
    • DHCP
    • Admin password from existingSecret is rejected
    • Query log shows the same client for every query
  • Upgrading
  • Uninstallation
  • Values

Prerequisites

  • Kubernetes 1.26+
  • Helm 3+
  • A default StorageClass if you enable persistence (persistentVolumeClaim.enabled)
  • A LoadBalancer provider such as MetalLB if you want to expose DNS/web on a routable IP

Quick Start

helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes/
helm repo update

helm install pihole mojo2600/pihole \
  --namespace pihole --create-namespace \
  --set admin.password=change-me

Open the web interface via port-forward:

kubectl port-forward svc/pihole-web -n pihole 8080:80
# then visit http://localhost:8080/admin

Point a client's DNS at the Pi-hole DNS service and you're blocking ads. For a real deployment, expose DNS with a LoadBalancer and enable persistence.

Installation

Add Helm repository

helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes/
helm repo update

Install the chart

Install with your own values file:

helm install pihole mojo2600/pihole \
  --namespace pihole --create-namespace \
  --values my-values.yaml

Jeff Geerling also made a video walking through the installation of this chart:

Access the web interface

By default the web service is a ClusterIP. Reach it with a port-forward:

kubectl port-forward svc/pihole-web -n pihole 8080:80
# then visit http://localhost:8080/admin

If you did not set admin.password, a random password is generated. Retrieve it from the secret:

kubectl get secret pihole-password -n pihole -o jsonpath='{.data.password}' | base64 -d; echo

Configuration

Every option can be set with --set key=value at install time or, preferably, in a values.yaml file passed with --values. See the Values table for the full list of parameters and their defaults.

Exposing Pi-hole

Choose how the DNS and web services are exposed:

  • ClusterIP — reachable only inside the cluster (the default for all services). Use with an Ingress or a port-forward.
  • LoadBalancer — exposes the service on an external IP via your cloud provider or MetalLB.
  • Ingress — set ingress.enabled: true to route the web interface through an ingress controller (which must already be installed).
  • Gateway API — set route.enabled: true and route.parentRefs to create an HTTPRoute instead of an Ingress (needs the Gateway API CRDs and a Gateway).

Making DNS reachable on port 53 (start here)

This is the most common stumbling block for new users. This chart installs Pi-hole, but it cannot know how your cluster is networked — so it can't automatically make DNS reachable to your clients. You have to pick an exposure strategy that fits your environment.

Why it needs special attention:

  • Clients send DNS queries to UDP/TCP port 53, a privileged, fixed port. Your router, phones and laptops cannot be told to use "port 31514" — they expect DNS on 53.
  • The default serviceDns.type is ClusterIP: DNS is only reachable inside the cluster. A NodePort doesn't help either, it publishes DNS on a random high port (30000–32767), not on 53, which clients on your LAN can't use as their DNS server.
  • Port 53 on the nodes is often already taken by the host OS resolver (e.g. systemd-resolved listening on 127.0.0.53:53, or dnsmasq). Binding Pi-hole directly to the host's port 53 will clash with it.

Common strategies, from most to least recommended:

  • LoadBalancer (recommended). Give the DNS service its own IP with port 53. On bare metal / home labs use MetalLB; on a cloud provider use its native load balancer. Point your clients (or your router's DHCP DNS setting) at that IP:

    serviceDns:
      type: LoadBalancer
      annotations:
        metallb.universe.tf/loadBalancerIPs: 192.168.178.252
    
  • hostNetwork / host port. Bind DNS directly onto a node's IP on port 53 (hostNetwork: true, or dnsHostPort.enabled: true). Simple, but the node must not already run a resolver on port 53 — otherwise disable systemd-resolved (or free up port 53) on that node first.

  • NodePort with a fixed port. Works, but NodePorts must fall in the 30000–32767 range by default, so you cannot serve 53 directly unless you widen --service-node-port-range on the API server. Usually not worth it.

If DNS "isn't working" after install, it's almost always because the DNS service is still a ClusterIP (the default) rather than exposed on a routable IP on port 53.

loadBalancerIP is deprecated

The spec.loadBalancerIP field is deprecated since Kubernetes 1.24 and may be removed in a future version. It still works in this chart, but prefer your provider's annotation-based approach.

MetalLB:

serviceDns:
  type: LoadBalancer
  annotations:
    metallb.universe.tf/loadBalancerIPs: 192.168.178.252

serviceWeb:
  type: LoadBalancer
  annotations:
    metallb.universe.tf/loadBalancerIPs: 192.168.178.252

Cloud providers: consult your provider's documentation for the appropriate annotation (e.g. service.beta.kubernetes.io/aws-load-balancer-eip-allocations for AWS).

Dual-stack (IPv4 + IPv6)

Set dualStack.enabled: true on a dual-stack cluster. Every service then becomes one dual-stack service (PreferDualStack) with an IPv4 and an IPv6 address. For a LoadBalancer, list both addresses in your load balancer's annotation. This works with MetalLB, Cilium LB IPAM, k3s ServiceLB and the major cloud providers:

dualStack:
  enabled: true
serviceDns:
  type: LoadBalancer
  annotations:
    metallb.universe.tf/loadBalancerIPs: 192.168.1.53,fd00::53
    # Cilium: io.cilium/lb-ipam-ips: 192.168.1.53,fd00::53

If your load balancer can't serve dual-stack services, set dualStack.splitLoadBalancer: true. Each LoadBalancer service is then split into an IPv4 service and a separate -ipv6 service. Set the IPv6 address with annotationsIPv6 (merged over annotations for the -ipv6 service only) or the deprecated loadBalancerIPv6:

dualStack:
  enabled: true
  splitLoadBalancer: true
serviceDns:
  type: LoadBalancer
  annotations:
    io.cilium/lb-ipam-ips: 192.168.1.53
  annotationsIPv6:
    io.cilium/lb-ipam-ips: fd00::53

Example values.yaml

A typical home setup exposing web and DNS on a shared MetalLB IP with persistence enabled:

ftl:
  dns_hosts: "192.168.178.10 nas.lan"
  dns_cnameRecords: "files.lan,nas.lan"

persistentVolumeClaim:
  enabled: true

serviceWeb:
  type: LoadBalancer
  annotations:
    metallb.universe.tf/loadBalancerIPs: 192.168.178.252
    metallb.universe.tf/allow-shared-ip: pihole-svc

serviceDns:
  type: LoadBalancer
  annotations:
    metallb.universe.tf/loadBalancerIPs: 192.168.178.252
    metallb.universe.tf/allow-shared-ip: pihole-svc

Admin password

Set the web interface password with admin.password, or reference an existing secret:

admin:
  enabled: true
  # inline password (stored in a generated secret)
  password: change-me
  # or reference your own secret instead:
  existingSecret: ""
  passwordKey: password

By default (admin.password empty, no existingSecret) a random password is generated into the <release>-password secret and kept across upgrades. Retrieve it as shown in Access the web interface. Set admin.enabled: false to disable password authentication entirely. The API then accepts changes from every pod that can reach the web Service, even when an SSO proxy protects the ingress; restrict it with a NetworkPolicy.

API clients without a password. Without a password, Pi-hole only accepts API requests whose Host header is one of its own names: an IP address, localhost, pi.hole, the web domain (virtualHost) or the pod's hostname. Other names get 401 (no password set, but request from another website). This affects in-cluster clients such as nebula-sync, dashboard widgets or exporters that call http://<release>-web.<namespace>.svc. With admin.enabled: false and hostname empty, the chart therefore sets the pod hostname to <release>-web, the web Service's name. Clients in the same namespace then use the short name, e.g. http://pihole-web. For clients in other namespaces, set a password; with a password the Host check doesn't apply. Set hostname yourself to override the default.

GitOps (Argo CD, Flux with server-side rendering off): tools that render the chart without access to the cluster can't see the existing secret and would generate a new password on every sync. Use existingSecret (e.g. from External Secrets or Sealed Secrets) instead.

Upstream DNS resolvers

Pi-hole forwards queries it cannot answer to DNS1 and DNS2 (default Google, 8.8.8.8 and 8.8.4.4). To use a single upstream, set DNS2: ""; for more than two, set ftl.dns_upstreams (semicolon-separated). With doh.enabled the upstream is the dnscrypt-proxy sidecar instead.

The pod's own DNS (used by Pi-hole itself, e.g. to download ad lists) is set separately by podDnsConfig; by default it is Pi-hole plus Google's 8.8.8.8. Change it, for example to use Cloudflare:

podDnsConfig:
  enabled: true
  policy: "None"
  nameservers:
  - 127.0.0.1
  - 1.1.1.1

To opt out of pod DNS configuration entirely (e.g. when running a service mesh):

podDnsConfig:
  enabled: false

Local DNS records

Use Pi-hole v6's own settings for local A/AAAA and CNAME records. They show up under Settings → Local DNS Records in the web interface, live in your values (Git), and are applied on every start:

ftl:
  # "IP hostname", separated by semicolons
  dns_hosts: "192.168.1.10 nas.lan;192.168.1.11 printer.lan"
  # "alias,target", separated by semicolons
  dns_cnameRecords: "files.lan,nas.lan"

Settings set this way are read-only in the web interface. If you prefer to manage records in the web interface instead, leave these unset and enable persistentVolumeClaim: Pi-hole stores them in /etc/pihole/pihole.toml.

The older dnsmasq.customDnsEntries (address=), dnsmasq.customCnameEntries and dnsmasq.additionalHostsEntries still work, but these records do not show in the web interface. A dnsmasq cname= only resolves when its target is a host record (ftl.dns_hosts, additionalHostsEntries or DHCP); a target defined with address= returns the CNAME without an address. Other dnsmasq options (e.g. an SRV record: srv-host=_vlmcs._tcp.lan,kms.lan,1688) go into ftl.misc_dnsmasq_lines.

Encrypted upstream DNS (DoH / DoT / DNSCrypt)

Set doh.enabled: true to run a dnscrypt-proxy sidecar that Pi-hole uses as its upstream resolver (this replaces the previously used cloudflared). Customize the resolver via doh.config (raw dnscrypt-proxy TOML):

doh:
  enabled: true
  config: |
    listen_addresses = ['0.0.0.0:5053']
    server_names = ['cloudflare', 'google']

To expose Prometheus metrics, enable [monitoring_ui] in doh.config and se

Deploy pihole with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pihole on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartpihole is pinned at v3.0.0-rc.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply