Here is what I figured out so far…
You can only assign one podman network to a single container so the other option is to use “allow-host-networks” (or try to use macvlan).
So here is how I got it working (so far with just one vrf, will continue digging if its possible for CheckMK to use both vrfs as in MGMT for webgui and PROD for snmp gets).
VyOS config:
Container config:
Room for improvement, define userid and groupid the container will be runned as. Will also affect ownership of /config/container/checkmk at the host.
I place the container directory in /config/container/ so when VyOS gets updated this will be moved to next version (VyOS is immutable and uses persitent directories where /config is copied to next version during update of VyOS).
allow-host-networks will expose the host interfaces to the container.
net-raw is needed for ping to work from within the container (otherwise you will get errors in CheckMK webgui during service discovery).
set container name checkmk allow-host-networks
set container name checkmk capability 'net-raw'
set container name checkmk environment CMK_PASSWORD value 'CHANGEME'
set container name checkmk environment TZ value 'Europe/Stockholm'
set container name checkmk image 'docker.io/checkmk/check-mk-community:2.5.0p17'
set container name checkmk memory '4096'
set container name checkmk restart 'on-failure'
set container name checkmk tmpfs tmp destination '/opt/omd/sites/cmk/tmp'
set container name checkmk tmpfs tmp size '2048'
set container name checkmk volume monitoring destination '/omd/sites'
set container name checkmk volume monitoring source '/config/container/checkmk'
Firewall config:
For troubleshooting in LAB I just accept everything but here is where you for production most likely need to tweak the ruleset.
set firewall ipv4 forward filter default-action 'accept'
set firewall ipv4 input filter default-action 'accept'
set firewall ipv4 output filter default-action 'accept'
set firewall ipv4 prerouting raw default-action 'accept'
set firewall ipv6 forward filter default-action 'drop'
set firewall ipv6 input filter default-action 'drop'
set firewall ipv6 output filter default-action 'drop'
set firewall ipv6 prerouting raw default-action 'drop'
Interface config:
eth0 is MGMT and eth1 is PROD.
set interfaces ethernet eth0 address '10.99.0.100/24'
set interfaces ethernet eth0 vrf 'MGMT'
set interfaces ethernet eth1 address '192.168.1.20/24'
set interfaces ethernet eth1 vrf 'PROD'
Route config:
Setup route-leak so vrf default (where the container runs at) can use vrf PROD as default gateway.
set protocols static route 0.0.0.0/0 next-hop 192.168.1.254 vrf 'PROD'
Sysctl config:
Needed for containers to bind to IP they dont necessary see during startup.
set system sysctl parameter net.ipv4.ip_nonlocal_bind value '1'
set system sysctl parameter net.ipv6.ip_nonlocal_bind value '1'
VRF config:
bind-to-all is needed for things to work as expected.
set vrf bind-to-all
set vrf name MGMT ipv6 disable-forwarding
set vrf name MGMT table '100'
set vrf name MGMT vni '10000100'
set vrf name PROD ipv6 disable-forwarding
set vrf name PROD protocols static route 0.0.0.0/0 next-hop 192.168.1.254 interface 'eth1'
set vrf name PROD table '101'
set vrf name PROD vni '10000101'
Then once the container is running at the host find out containerid of CheckMK (note this will change on every start of container):
sudo podman ps -a
And enter this container:
sudo podman exec -it <id> /bin/bash
Run omd in interactive mode to get to the basic-settings and there change “TMPFS: off” to “TMPFS: on”, when done dont forget to restart the container.
omd config cmk
You can also do this to print out current settings:
omd config cmk show
While at it you probably also want to change max_concurrent_checks in /config/container/checkmk/cmk/etc/nagios/nagios.d/timing.cfg to something like 2x number of cores (VCPU) available.
Bonus:
When attempting to use network instead of allow-host-networks for your contaiener you might need to create a Source NAT rule for egress traffic (SNMP polling) to work.
set nat source rule 10 description 'Outbound NAT for Podman IP-range using VRF PROD'
set nat source rule 10 outbound-interface name 'eth1'
set nat source rule 10 source address '10.88.0.0/16'
set nat source rule 10 translation address 'masquerade'