Skip to main content

AdGuard on Kubernetes

·1 min

AdGuard #

AdGuard Home is a network-wide software for blocking ads & tracking

Adguard is similar to Pi-Hole with more features. Comparison of Adguard to Pi-Hole

The below configuration has worked for me. I am a big fan of helm charts, and I’ll be using AdGuard chart

Configure chart #

Pull chart locally

helm repo add billimek https://billimek.com/billimek-charts/
helm fetch billimek/adguard-home

Update deployment to use hostNetwork

#templates/deployment.yaml
...
  spec:
    hostNetwork: true
    securityContext:
...

Enable configAsCode, update bind_host to Kubernetes host IP in values.yaml

# values.yaml
configAsCode:
  enabled: true
  config:
    bind_host: 192.168.0.101
    bind_port: 3000
    dns:
      bind_host: 192.168.0.101

Update securityContext to run as a privileged pod, drop all capabilities and add NET_BIND_SERVICE

# values.yaml
securityContext:
  privileged: true
  capabilities:
    drop:
      - ALL
    add:
      - NET_BIND_SERVICE

Add nodeSelector to assign a pod to that node.

# values.yaml
nodeSelector:
  kubernetes.io/hostname: node3

Deploy helm chart

helm install adguard-home

Wait for AdGuard pods.

kubectl get pods
NAME                                    READY   STATUS    RESTARTS   AGE
adguard-adguard-home-67975f7768-v6bg9   1/1     Running   0          43h

Configure your devices to use your AdGuard Home #

Once we’ve established that AdGuard Home has deployed, you can use it on other computers in your network by changing their system DNS settings to use the Kubernetes node’s IP address (which is 192.168.0.101 in our case).