Open edmack opened 2 years ago
Indeed, I'm having the same issue. Step #4 defines the network podman should create, but there's nothing after it that actually gets it up and running. You can verify this with "podman network ls", which won't have a "dns" network until you run /mnt/data/on_boot.d/05-install-cni-plugins.sh again after creating 20-dns-conflist.
Step 4 is copying the conf file into place; I don't see how this action could set up the network (** another correction that could be made to the step description). In 05-install-cni-plugins.sh, the function “populate_netd” can’t process 20-dns.sh—creating a softlink under /etc/cni/net.d/—because the file hasn’t yet been copied there.
So, to repro. For some reason, I cannot delete my “dns” network: # podman network rm dns Error: failed to find network interface name in "/etc/cni/net.d/20-dns.conflist": unable to find interface name for network
Instead, I’ll use a new network, “dnstest”. I updated 10-dns.sh to use the new vlan with matching ip addresses, 20-dns.conflist to use the “dnstest” network and its addresses, and the “run” command to use the “dnstest” network and matching server address.
Following the documented steps: Step 1 is not needed because the plug-in script is already in place and doesn’t need to change for the test.
Step 2: # /mnt/data/on_boot.d/05-install-cni-plugins.sh Pouring /mnt/data/.cache/cni-plugins/cni-plugins-linux-arm64-v1.0.1.tgz
(Show that 20-dnstest.conflist is not yet in either locations:) # ls /mnt/data/podman/cni/ 20-dns.conflist # ls /etc/cni/net.d/ 10-libpod.conflist 20-dns.conflist
Step 3: Created network “dnstest” on the controller.
Step 4: # cp 20-dnstest.conflist /mnt/data/podman/cni/
(Demonstrate that the “dnstest” network has not been created) # podman network ls NAME VERSION PLUGINS podman 0.4.0 bridge,portmap dns 0.4.0 macvlan
Step 5: # cp 10-dnstest.sh /mnt/data/on_boot.d/
Step 6: # /mnt/data/on_boot.d/10-dnstest.sh logger: unknown priority name: ERROR Container pihole not found, make sure you set the proper name, you can ignore this error if it is your first time setting it up
(The network is still not there) # podman network ls NAME VERSION PLUGINS podman 0.4.0 bridge,portmap dns 0.4.0 macvlan
Step 7: # mkdir -p /mnt/data/etc-pihole-test # mkdir -p /mnt/data/pihole-test/etc-dnsmasq.d
Step 8:
# ./run-pihole-test.sh
Trying to pull docker.io/pihole/pihole:latest...
Getting image source signatures
Copying blob f1d70d0cecf6 done
Copying blob 49aabdeceda1 done
Copying blob 753408153c81 done
Copying blob 58952488aee3 done
Copying blob a6a25169eb8e done
Copying blob aef6f138b30a done
Copying blob bbac4f90345b done
Copying blob da2dbe10d69d done
Copying config e7408bdcb1 done
Writing manifest to image destination
Storing signatures
ERRO[0021] CNI network "dnstest" not found
Error: error configuring network namespace for container ba1e9d77efba0131b3c294a0feb70c3dbce637201c03714ab4098709e195d467: CNI network "dnstest" not found
(The “dnstest” network is still not there) # podman network ls NAME VERSION PLUGINS podman 0.4.0 bridge,portmap dns 0.4.0 macvlan
Now, to validate that the 20-dns.confist needs to be there before 05-install-cni-plugins.sh is run, now that the file has been copied there--in Step 4, which should be Step 2--let's run the plug-in script now and see what happens:
# /mnt/data/on_boot.d/05-install-cni-plugins.sh Pouring /mnt/data/.cache/cni-plugins/cni-plugins-linux-arm64-v1.0.1.tgz # ls /etc/cni/net.d/ 10-libpod.conflist 20-dns.conflist 20-dnstest.conflist # podman network ls NAME VERSION PLUGINS podman 0.4.0 bridge,portmap dns 0.4.0 macvlan dnstest 0.4.0 macvlan
(sorry, @roynuj, I misunderstood your comment ... yes, you already verified that the plug-in script needs to be run after the copy!)
Yep, sorry, edited and clarified my comment.
if it doesnt see dnstest its either not in the right directory or there is a syntax error, did you run it through a json linter?
@boostchicken The issue is just in the ordering of steps in the setup guide. Step #4 (Copy 20-dns.conflist to /mnt/data/podman/cni. This will create your podman macvlan network) should be before Step #2 (Execute /mnt/data/on_boot.d/05-install-cni-plugins.sh). Step #4 defines the network, but never starts it. Step #2 starts it, but since it's before Step #4, the network is never started with the current order of steps in the guide.
Following the steps in the run-pihole project, running /mnt/data/on_boot.d/05-install-cni-plugins.sh (Step 2) before you have copied 20-dns.conflist to /mnt/data/podman/cni (Step 4), will result in the error "CNI network not found" (in Step 8). Copying of 20-dns.conflist should precede executing /mnt/data/on_boot.d/05-install-cni-plugins.sh.
To reproduce this, I first restore the state of my configuration to look like it would prior to running Step 2 (also, I don't need to delete the pihole image to reproduce the issue, just the container): # rm /etc/cni/net.d/20-dns.conflist # mv /mnt/data/podman/cni/20-dns.conflist ~/ # podman rm pihole 3320acccc6cf971511297f2be29646721e0ad8a0687bdac00309ceaa56904893
Now, run steps 2, 3, 4, and 8 (the others have nothing to do with creating a link to 20-dns.conflist under /etc/cni/net.d/): # /mnt/data/on_boot.d/05-install-cni-plugins.sh (Step 2) Pouring /mnt/data/.cache/cni-plugins/cni-plugins-linux-arm64-v1.0.1.tgz (Step 3: Create the network on the controller) # cp 20-dns.conflist /mnt/data/podman/cni/ (Step 4) # ./run-container.sh (Step 8; see script contents, below) ERRO[0000] CNI network "dns" not found
Error: error configuring network namespace for container a784a967eb730c0630d776d9ca62771dff09c83401afd4e0628fc44140f320f8: CNI network "dns" not found
Where run-container.sh contains: #!/bin/sh
podman run -d --network dns --restart always \ --name pihole \ -e TZ="America/Los Angeles" \ -v "/mnt/data/etc-pihole/:/etc/pihole/" \ -v "/mnt/data/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/" \ --dns=127.0.0.1 \ --dns=1.1.1.1 \ --dns=8.8.8.8 \ --hostname pi.hole \ -e VIRTUAL_HOST="pi.hole" \ -e PROXY_LOCATION="pi.hole" \ -e ServerIP="192.168.4.4" \ -e IPv6="False" \ pihole/pihole:latest
If I copy 20-dns.conflist to /mnt/data/podman/cni/ before running the plug-in script, the link to the file is created under /etc/cni/net.d/ and the network is found. I happen to get different errors that I have not yet worked through, but the "network not found" error is not encountered.
After deleting the container and deleting 20-dns.conflist from /mnt/data/podman/cni/: # cp 20-dns.conflist /mnt/data/podman/cni/ # /mnt/data/on_boot.d/05-install-cni-plugins.sh Pouring /mnt/data/.cache/cni-plugins/cni-plugins-linux-arm64-v1.0.1.tgz # ./run-container.sh ERRO[0000] Error adding network: Link not found
ERRO[0000] Error while adding pod to CNI network "dns": Link not found Error: error configuring network namespace for container 7390ca652a87037b8b84017255b71cca692ec7918ff4570ac3cede63c630d9ad: Link not found