Simple bridge network for kubernetes
How it works
bridget is a short shell script that helps you to organise simple bridged network for Kubernetes. There are no overlays, no policies. Just a flat L2-network across all your hosts and pods.
In addition bridget can automatically configure VLAN and bridge interfaces for that. See the picture:
bridget automatically retrieves node cidr from your pod-network and configures cni to use it.
All parameters are passed as environment variables:
- BRIDGE (example:
cbr0) - Bridge name. Mandatory option.
- VLAN (example:
100) - VLAN id. If set, a new vlan-interface under IFACE will be created and added to BRIDGE.
- IFACE (example:
eth0) - Physical interface to connect bridge to. Mandatory if VLAN is set, but can also be used alone.
- MTU (default:
1500) - MTU value for cni config
- CHECK_SLAVES (default:
1) - Make bridget configure slave interfaces if the bridge already exists.
- POD_NETWORK (default:
10.244.0.0/16) - Your pod network.
- DEBUG (default:
0) - Enable verbose output.
Instantiate your kubernetes with
Download yaml file:
curl -O https://raw.githubusercontent.com/kvaps/bridget/master/bridget.yaml
- Edit desired parameters:
By default bridget uses
cbr0 bridge that isn't connected anywhere, so you need to either set IFACE and VLAN parameters
or configure your host system to connect the physical interface to this bridge manually.
Please make sure that you have no IP address on the bridge because it will be configured automatically.
- Run daemonset:
kubectl create -f bridget.yaml
kubectl delete -f bridget.yaml kubectl create -f bridget.yaml
There aren't a lot of alternatives if you want to use flat L2-network with kubernetes.
Even with most of the existing solutions like flannel's or romana's L2 modes it's still quite difficult to use your own rules for NATing and routing. So you gain flexible policies and some other things, but lose simplicity and productivity of a simple L2-network.
Bridget was created under pipework's inspiration. pipework allows you to add single interfaces to your containers, but with additional manual actions, and Kubernetes doesn't know anything about your manual changes.
Unlike pipework, bridget uses CNI to configure pod interfaces. As a result all configuration occurs automatically and kubernetes gets right IP-addresses.
Use Pull Requests to contribute bugfixes or new features. It is assumed that your code and documentation are contributed under the Apache License 2.0.
Please use github issue-tracker to submit bugs
bridget is distributed under the Apache 2.0 license. See the LICENSE file for details.