pihole in Docker using Truenas Scale guide unable to get IP or run with Host Networking

DaSnipe

Explorer
Joined
Jun 26, 2021
Messages
86
Hi everyone

I installed pihole using the guide as suggested by TrueNAS inside the docs See TrueNAS Documentation site here and got it running

Without enable Host Networking I didn't get an IP inside pihole, see below (able to access it through :9080/admin/)

1626912120686.png


So I stopped the app and enabled Host Networking, which gives me these errors

Since then I'm getting these errors

2021-07-21 19:54:21
Scaled up replica set pihole-ix-chart-5996cf7c97 to 1
2021-07-21 19:54:21
Created pod: pihole-ix-chart-5996cf7c97-k82m2

0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.

0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.
2021-07-21 19:54:33
Scaled down replica set pihole-ix-chart-5996cf7c97 to 0

skip schedule deleting pod: ix-pihole/pihole-ix-chart-5996cf7c97-k82m2
2021-07-21 19:54:33
Deleted pod: pihole-ix-chart-5996cf7c97-k82m2
2021-07-21 19:55:02
Scaled up replica set pihole-ix-chart-856d48d95 to 1
2021-07-21 19:55:02
Created pod: pihole-ix-chart-856d48d95-9bgkr

0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.


These are the advanced settings inside the Installed Applications tab. I have a secondary NIC installed but haven't used it yet

1626912041131.png


I'm obviously missing something but unsure what. I have 3 applications installed through TrueCharts running great so unsure what I missed.

Thanks in advance!
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
The only thing that stands out to me is this:

0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.

When you enable host networking, it means if one of the ports the container wants is already in use (on the host), it won't be able to deploy. Do you know offhand what list of ports PiHole is trying to expose here?
 

DaSnipe

Explorer
Joined
Jun 26, 2021
Messages
86
53, 67, 80, 443 according to the guide. I can see why 80 by TrueNAS itself might be in use which makes sense to remap to port 9080

I remapped them to 9053, 9067, 9080 and 9443 respectively, as followed shown below in the TrueNAS docs

1626962773965.png
 

Attachments

  • 1626962883122.png
    1626962883122.png
    27.7 KB · Views: 782

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
Afaik with hostNetworking enabled you don't use nodeport, so you cannot actually "remap" anything.

Anyway, I just donnot get why you are so OCD on "not getting an IP", pihole gets an IP just fine otherwise you couldn't connect to the webinterface in the first place. 0.0.0.0 just means "accept calls on any IP"
 

DaSnipe

Explorer
Joined
Jun 26, 2021
Messages
86
Afaik with hostNetworking enabled you don't use nodeport, so you cannot actually "remap" anything.

Anyway, I just donnot get why you are so OCD on "not getting an IP", pihole gets an IP just fine otherwise you couldn't connect to the webinterface in the first place. 0.0.0.0 just means "accept calls on any IP"

That's what confused me, I'm still new to pihole so was wondering why it was like this, thought I had to do an extra step since it didn't get an external IP. So if I want to set the DNS on my devices on pihole I need to set the same IP as my TrueNAS box (the enp0s31f6 adapter) and should be good to go I hope lol
 

DaSnipe

Explorer
Joined
Jun 26, 2021
Messages
86
Something is not forwarding to the DNS ports, since whenever I set my DNS to 192.168.50.94 (IP of my TrueNAS box) on any device I can't resolve queries.

I see this inside the PiHole -> Tools -> Network

1627083693030.png


I also tried to use the ServerIP environmental argument to manually set it to my TrueNAS IP also

1627083600279.png


Which is received by pihole but doesn't change anything, so weird

1627083746550.png


I guess I'm out of ideas lol, here's my pihole log if people are curious


2021-07-23 02:22:01.540702+00:00[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
2021-07-23 02:22:01.570220+00:00[s6-init] ensuring user provided files have correct perms...exited 0.
2021-07-23 02:22:01.571542+00:00[fix-attrs.d] applying ownership & permissions fixes...
2021-07-23 02:22:01.573320+00:00[fix-attrs.d] 01-resolver-resolv: applying...
2021-07-23 02:22:01.578642+00:00[fix-attrs.d] 01-resolver-resolv: exited 0.
2021-07-23 02:22:01.579377+00:00[fix-attrs.d] done.
2021-07-23 02:22:01.580348+00:00[cont-init.d] executing container initialization scripts...
2021-07-23 02:22:01.581821+00:00[cont-init.d] 20-start.sh: executing...
2021-07-23 02:22:01.629263+00:00::: Starting docker specific checks & setup for docker pihole/pihole
2021-07-23 02:22:01.645520+00:002021-07-23T02:22:01.645520442Z
2021-07-23 02:22:01.645570+00:00 Installing configs from /etc/.pihole...
2021-07-23 02:22:01.647807+00:00 Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
2021-07-23 02:22:01.650014+00:00 Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... [K [✓] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf
2021-07-23 02:22:01.789504+00:00Existing DNS servers detected in setupVars.conf. Leaving them alone
2021-07-23 02:22:01.794192+00:00::: Pre existing WEBPASSWORD found
2021-07-23 02:22:01.794408+00:00DNSMasq binding to default interface: eth0
2021-07-23 02:22:01.812634+00:00Added ENV to php:
2021-07-23 02:22:01.813263+00:00"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log",
2021-07-23 02:22:01.813283+00:00"ServerIP" => "192.168.50.94",
2021-07-23 02:22:01.813296+00:00"VIRTUAL_HOST" => "192.168.50.94",
2021-07-23 02:22:01.817734+00:00Using IPv4 and IPv6
2021-07-23 02:22:01.818596+00:00::: Preexisting ad list /etc/pihole/adlists.list detected ((exiting setup_blocklists early))
2021-07-23 02:22:01.819111+00:00https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
2021-07-23 02:22:01.832874+00:00::: Testing pihole-FTL DNS: FTL started!
2021-07-23 02:22:01.859392+00:00::: Testing lighttpd config: Syntax OK
2021-07-23 02:22:01.859648+00:00::: All config checks passed, cleared for startup ...
2021-07-23 02:22:01.862239+00:00::: Enabling Query Logging
2021-07-23 02:22:01.867142+00:00 Enabling logging...
2021-07-23 02:22:01.868959+00:00[K [✓] Logging has been enabled!
2021-07-23 02:22:01.869157+00:00::: Docker start setup complete
2021-07-23 02:22:01.886044+00:00Pi-hole version is v5.3.1 (Latest: v5.3.1)
2021-07-23 02:22:01.892276+00:00AdminLTE version is v5.5 (Latest: v5.5)
2021-07-23 02:22:01.895307+00:00FTL version is v5.8.1 (Latest: v5.8.1)
2021-07-23 02:22:01.896215+00:00[cont-init.d] 20-start.sh: exited 0.
2021-07-23 02:22:01.897103+00:00[cont-init.d] done.
2021-07-23 02:22:01.898271+00:00[services.d] starting services
2021-07-23 02:22:01.903099+00:00Starting pihole-FTL (no-daemon) as root
2021-07-23 02:22:01.903133+00:00Starting crond
2021-07-23 02:22:01.903162+00:00Starting lighttpd
2021-07-23 02:22:01.907115+00:00[services.d] done.
2021-07-23 02:22:01.540702+00:00[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
2021-07-23 02:22:01.570220+00:00[s6-init] ensuring user provided files have correct perms...exited 0.
2021-07-23 02:22:01.571542+00:00[fix-attrs.d] applying ownership & permissions fixes...
2021-07-23 02:22:01.573320+00:00[fix-attrs.d] 01-resolver-resolv: applying...
2021-07-23 02:22:01.578642+00:00[fix-attrs.d] 01-resolver-resolv: exited 0.
2021-07-23 02:22:01.579377+00:00[fix-attrs.d] done.
2021-07-23 02:22:01.580348+00:00[cont-init.d] executing container initialization scripts...
2021-07-23 02:22:01.581821+00:00[cont-init.d] 20-start.sh: executing...
2021-07-23 02:22:01.629263+00:00::: Starting docker specific checks & setup for docker pihole/pihole
2021-07-23 02:22:01.645520+00:002021-07-23T02:22:01.645520442Z
2021-07-23 02:22:01.645570+00:00 Installing configs from /etc/.pihole...
2021-07-23 02:22:01.647807+00:00 Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
2021-07-23 02:22:01.650014+00:00 Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... [K [✓] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf
2021-07-23 02:22:01.789504+00:00Existing DNS servers detected in setupVars.conf. Leaving them alone
2021-07-23 02:22:01.794192+00:00::: Pre existing WEBPASSWORD found
2021-07-23 02:22:01.794408+00:00DNSMasq binding to default interface: eth0
2021-07-23 02:22:01.812634+00:00Added ENV to php:
2021-07-23 02:22:01.813263+00:00"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log",
2021-07-23 02:22:01.813283+00:00"ServerIP" => "192.168.50.94",
2021-07-23 02:22:01.813296+00:00"VIRTUAL_HOST" => "192.168.50.94",
2021-07-23 02:22:01.817734+00:00Using IPv4 and IPv6
2021-07-23 02:22:01.818596+00:00::: Preexisting ad list /etc/pihole/adlists.list detected ((exiting setup_blocklists early))
2021-07-23 02:22:01.819111+00:00https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
2021-07-23 02:22:01.832874+00:00::: Testing pihole-FTL DNS: FTL started!
2021-07-23 02:22:01.859392+00:00::: Testing lighttpd config: Syntax OK
2021-07-23 02:22:01.859648+00:00::: All config checks passed, cleared for startup ...
2021-07-23 02:22:01.862239+00:00::: Enabling Query Logging
2021-07-23 02:22:01.867142+00:00 Enabling logging...
2021-07-23 02:22:01.868959+00:00[K [✓] Logging has been enabled!
2021-07-23 02:22:01.869157+00:00::: Docker start setup complete
2021-07-23 02:22:01.886044+00:00Pi-hole version is v5.3.1 (Latest: v5.3.1)
2021-07-23 02:22:01.892276+00:00AdminLTE version is v5.5 (Latest: v5.5)
2021-07-23 02:22:01.895307+00:00FTL version is v5.8.1 (Latest: v5.8.1)
2021-07-23 02:22:01.896215+00:00[cont-init.d] 20-start.sh: exited 0.
2021-07-23 02:22:01.897103+00:00[cont-init.d] done.
2021-07-23 02:22:01.898271+00:00[services.d] starting services
2021-07-23 02:22:01.903099+00:00Starting pihole-FTL (no-daemon) as root
2021-07-23 02:22:01.903133+00:00Starting crond
2021-07-23 02:22:01.903162+00:00Starting lighttpd
2021-07-23 02:22:01.907115+00:00[services.d] done.
 

Constantin

Vampire Pig
Joined
May 19, 2017
Messages
1,829
FWIW, I wonder to what extent the Akamai edge DNS failure this week could have been mitigated with a Pi-hole DNS server. I have mine set up as such with the help of the blogs at Derek Seaman’s site (enabling DNSSEC downloads and auto updates for the Pi but not the pi-hole application since that needs a command-line instruction to be triggered).

However, I wasn’t online for the affected hour and hence could not test. The ad-blocking capabilities of pi-hole are impressive! I would enable two carbon copies to allow failovers during maintenance and so on.
 

JenJen

Dabbler
Joined
Jun 30, 2021
Messages
19
Hello,

I have PiHole on my truenas SCALE. I had exactly the same error than you but I fix it, I hope this will help you:

In red : a free IP
1627304928017.png

In red : the same IP
1627304958947.png


In red : free port >= 9000
1627304990865.png


You need to access at your Pihole like that:
1627305224077.png


In your router:
1627305241313.png


In result ;) :
1627304785622.png


JenJen
 

DaSnipe

Explorer
Joined
Jun 26, 2021
Messages
86
Hello,

I have PiHole on my truenas SCALE. I had exactly the same error than you but I fix it, I hope this will help you:

In red : a free IP
View attachment 48518
In red : the same IP
View attachment 48519

In red : free port >= 9000
View attachment 48520

You need to access at your Pihole like that:
View attachment 48521

In your router:
View attachment 48522

In result ;) :
View attachment 48515

JenJen

Merci infiniment! (Je suis Montréalais/Canadien) C'était exactement l'étape qui me manquait! Je ne savais pas comment choisir un IP autre que celle de TrueNAS et maintenant tout marche super bien.

The images that JenJen shared got me to the root of the issue. Thanks again! I wasn't sure how to set an IP for the DNS since I couldn't use the IP of my TrueNAS box for Pihole but with a new IP everything is working great. Might be worth adding to the TrueNAS guide (HERE) in case others run into the same issues, won't work for everything but at least it gets pihole running
 

Constantin

Vampire Pig
Joined
May 19, 2017
Messages
1,829
I’m thinking of installing pi-hole also on a third Pi that also acts as a NTP server. The load of either service is next to nothing. Having a dedicated pi for each service makes for simpler maintenance but is unlikely to be necessary.
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
I’m thinking of installing pi-hole also on a third Pi that also acts as a NTP server. The load of either service is next to nothing. Having a dedicated pi for each service makes for simpler maintenance but is unlikely to be necessary.
If you looking at getting a 3rd Pi I might point you to ESXi for Arm. Although it is still a VMware fling, it is very well developed and documented and adds tremendous flexibility to an already versatile platform.
 

Constantin

Vampire Pig
Joined
May 19, 2017
Messages
1,829
Fascinating and something I’ll have to look into when I have more time. Thank you.
 

highwaystar

Cadet
Joined
Nov 18, 2021
Messages
3
Hi,
i have setup pihole on my TrueNAS Scale and it is running. However i have the same problem as described above by DaSnipe, i.e. i cannot assign a dedicated IP address to pihole and therefore it does not seem to work. I tried to follow what JenJen has done, however those settings of adding an external interface don't seem to be available anymore. I'm running TrueNAS-SCALE-22.02-RC.1-1 and getting the apps from truecharts.
Any help would be much appreciated, thanks.
 

LarsR

Guru
Joined
Oct 23, 2020
Messages
719
My pihole doesnt have an Up either. With IP 0.0.0.0 it will listen to your truenas box's IP. In my Case 192.168.2.3. i Just added that IP as my primary DNS in my Router and it started working Like it would with a dedicated ip
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
Hi,
i have setup pihole on my TrueNAS Scale and it is running. However i have the same problem as described above by DaSnipe, i.e. i cannot assign a dedicated IP address to pihole and therefore it does not seem to work. I tried to follow what JenJen has done, however those settings of adding an external interface don't seem to be available anymore. I'm running TrueNAS-SCALE-22.02-RC.1-1 and getting the apps from truecharts.
Any help would be much appreciated, thanks.
It's best not to necro 6 months old posts.
Anyway: the info posted by @JenJen does not apply to TrueCharts. As we're kubernetes native, this hack by iX systems has not been implemented by us.

Our solution, like all kubernetes native projects, is using LoadBalancer services.
For RC1 we have do have a "somewhat" workaround and for RC2 we have merged a fix to the SCALE codebase.
But both of these solutions do not look anywhere close to the solution by @JenJen

If you need help with TrueCharts, it's most efficient to file a support ticket at our support discord directly.
 

highwaystar

Cadet
Joined
Nov 18, 2021
Messages
3
thanks both for the quick answers. I just realized that JenJen's post was related to launching manually a docker container, whereas i tried the truecharts way.
However i both ways i cannot get pihole to work as a DNS server. I can access the admin page, but as soon as i set the TrueNAS IP (truecharts way) or the dedicated IP (manual docker setup) as my primary DNS server, i don't get any replies from pihole, well, pihole does not even get requests. It is for sure a problem on my side, i just can't find it.
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
thanks both for the quick answers. I just realized that JenJen's post was related to launching manually a docker container, whereas i tried the truecharts way.
However i both ways i cannot get pihole to work as a DNS server. I can access the admin page, but as soon as i set the TrueNAS IP (truecharts way) or the dedicated IP (manual docker setup) as my primary DNS server, i don't get any replies from pihole, well, pihole does not even get requests. It is for sure a problem on my side, i just can't find it.
We are sure the TrueCharts Pihole App works, if you've any issues please file a support request at us directly.
 

lashmahan80

Cadet
Joined
Jun 17, 2022
Messages
5
my issue got solve using truecharts pihole version 2021.10_4.0.12 using default settings when setting up the pod. thanks for the help @truecharts
Having the same issue, installed with default settings with no luck, can't figure out how to direct devices to pihole so that it will recieve the queries.
 
Top