I'm a little bit confused with the use of network bridges in docker / k8s setups.
My understanding is that a network bridge operates exclusively at layer 2 and is used to combine 2 network segments into a single broadcast domain.
When reading about docker / K8s I see network bridges used to link the host NIC (e.g. eth0) with the internal docker / pod NIC (veth0) e.g within a single host:
eth0 [192.168.1.100] <----> docker0(bridge)[172.17.0.1] <----> veth0 [172.17.0.2]
My first point of confusion is that it seems strange to link two seperate subnets with a layer 2 device, don't we need to route from the 192... network to the 172... or does it not matter due to the bridge operating only at layer 2? E.g. it doesn't care about the actual IP addresses
My second thought is that judging by the routing table on my docker host, there is a route defined to reach the 172.17.0.0 network:
172.17.0.0/16 dev docker0
so why do we need the bridge device, couldn't the host just route packets from eth0 directly to the docker container NICs?
I'm clearly missing something here so apologies in advance. Any help is greatly appreciated.