pihole-kubernetes
pihole-kubernetes copied to clipboard
configuring services using traefik annotations
Hello,
I am running a k3s cluster on two raspberryPis.
❯ kubectl get services -A
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 17h
kube-system kube-dns ClusterIP 10.43.0.10 <none> 53/UDP,53/TCP,9153/TCP 17h
kube-system metrics-server ClusterIP 10.43.54.24 <none> 443/TCP 17h
kube-system traefik LoadBalancer 10.43.25.3 192.168.0.20,192.168.0.21 80:30437/TCP,443:30849/TCP 7h10m
I am noticing, that having traefik running AND running it on port 80 could be a problem.
To get Pi-hole up dan running I was using this command
helm install pihole mojo2600/pihole -f values.yaml -n pihole
using the following values.yaml file:
replicaCount: 1
dnsmasq:
customDnsEntries:
# Add custom DNS records in
# dnsmasq-installation of Pi-Hole
- address=/pihole.local/192.168.0.20
persistentVolumeClaim:
enabled: true
serviceWeb:
annotations:
metallb.universe.tf/address-pool: pihole
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
serviceDns:
annotations:
metallb.universe.tf/address-pool: pihole
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
adminPassword: admin
I noticed, that the annotation set to use metallb
and not traefik
That being said, I'd like to ask kindly for advice how to setup the annotations to work with traefik in order to get the serviceWeb
up and running. I hope this is the issue why the pihole-web
service is not starting
❯ kubectl get services -A
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 18h
kube-system kube-dns ClusterIP 10.43.0.10 <none> 53/UDP,53/TCP,9153/TCP 18h
kube-system metrics-server ClusterIP 10.43.54.24 <none> 443/TCP 18h
kube-system traefik LoadBalancer 10.43.25.3 192.168.0.20,192.168.0.21 80:30437/TCP,443:30849/TCP 7h19m
pihole pihole-dhcp NodePort 10.43.156.198 <none> 67:32395/UDP 3m25s
pihole pihole-web LoadBalancer 10.43.111.140 <pending> 80:30850/TCP,443:30177/TCP 3m25s
pihole pihole-dns-udp LoadBalancer 10.43.55.156 192.168.0.20,192.168.0.21 53:32654/UDP 3m25s
pihole pihole-dns-tcp LoadBalancer 10.43.22.102 192.168.0.20,192.168.0.21 53:30533/TCP 3m25s
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system metrics-server-9cf544f65-ptscs 1/1 Running 123 (7h26m ago) 18h
kube-system local-path-provisioner-64ffb68fd-cnspg 1/1 Running 126 (7h21m ago) 18h
kube-system coredns-85cb69466-bmrxz 1/1 Running 167 (7h24m ago) 18h
kube-system helm-install-traefik-crd--1-rkq6c 0/1 Completed 82 18h
kube-system helm-install-traefik--1-qlm9b 0/1 Completed 83 18h
kube-system svclb-traefik-dz4bn 2/2 Running 0 7h19m
kube-system svclb-traefik-8sjm9 2/2 Running 0 7h19m
kube-system traefik-74dd4975f9-8c6hj 1/1 Running 0 7h19m
pihole svclb-pihole-web-wb2h2 0/2 Pending 0 3m52s
pihole svclb-pihole-web-dm72k 0/2 Pending 0 3m51s
pihole svclb-pihole-dns-udp-xtqnx 1/1 Running 0 3m53s
pihole svclb-pihole-dns-udp-w66kt 1/1 Running 0 3m53s
pihole svclb-pihole-dns-tcp-tpdpn 1/1 Running 0 3m52s
pihole svclb-pihole-dns-tcp-blnxv 1/1 Running 0 3m52s
pihole pihole-76b8d674fd-stxst 1/1 Running 0 3m52s
Thanks in advance!
Hi, Just change the port for pihole-web. I use following values.yaml file:
replicaCount: 1
persistentVolumeClaim:
enabled: true
ingress:
enabled: false
serviceWeb:
loadBalancerIP: 10.61.61.111
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
http:
port: 8080
https:
port: 8443
serviceDns:
loadBalancerIP: 10.61.61.111
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
From what I have been learning with k3s traefik, we should not need to change the the service to loadbalancer for pihole. It should remain on clusterip. There is something else that is missing and I havent figured it out yet. I get a 404 but that is as close as I get.
@avendretter I have figured it out for k3s traefik ingress. This is the basic values.yml to get it working.
---
ingress:
enabled: true
adminPassword: admin
Then edit your /etc/hosts file with loadbalancer ip chart-example.local
The chart-example.local is the default value in the complete values file. You can change that in the values file but adding a line to ingress so that it looks like this
ingress:
enabled: true
hosts:
# virtualHost (default value is pi.hole) will be appended to the hosts
- pihole.home
Then update your /etc/hosts with the lb ip and the host you put for ingress.
For some reason when you try to go to pi.hole it just gives a 404 on the cluster.
I think the issue here is the comment in the values file:
# virtualHost (default value is pi.hole) will be appended to the hosts
After the deployment using the default values, I can only access the console as "chart-example.local" but not as "pi.hole":
$ kubectl get ingress --all-namespaces
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
pihole pihole <none> chart-example.local 192.168.2.157,192.168.2.164 80 102s
Either the comment is wrong or the deployment does not work as the comment stipulates.
I think #221 is related to this issue. But I have no idea how to solve this. Any ideas?