bridget/README.md

101 lines
3.6 KiB
Markdown
Raw Normal View History

2017-12-22 15:44:33 +03:00
# bridget
2017-12-22 16:07:50 +03:00
![](images/logo.svg)
2017-12-22 15:44:33 +03:00
2020-05-29 01:20:30 +03:00
Simple bridge network for kubernetes
2017-12-22 15:44:33 +03:00
![](https://img.shields.io/docker/build/kvaps/bridget.svg)
2017-12-22 16:07:50 +03:00
## How it works
2020-05-29 01:20:30 +03:00
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.
2017-12-22 16:35:05 +03:00
In addition bridget can automatically configure VLAN and bridge interfaces for that. See the picture:
2017-12-22 16:07:50 +03:00
![](images/scheme.svg)
2017-12-22 16:35:05 +03:00
2020-05-29 01:20:30 +03:00
bridget automatically retrieves node cidr from your pod-network and configures cni to use it.
2017-12-22 16:58:35 +03:00
## Parameters
2020-05-29 01:20:30 +03:00
All parameters are passed as environment variables:
2017-12-22 17:08:09 +03:00
2017-12-22 16:58:35 +03:00
- **BRIDGE** *(example: `cbr0`)* - Bridge name. Mandatory option.
2020-05-29 01:20:30 +03:00
- **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.
2017-12-22 16:58:35 +03:00
- **MTU** *(default: `1500`)* - MTU value for cni config
2020-05-29 01:20:30 +03:00
- **CHECK_SLAVES** *(default: `1`)* - Make bridget configure slave interfaces if the bridge already exists.
2017-12-22 16:58:35 +03:00
- **POD_NETWORK** *(default: `10.244.0.0/16`)* - Your pod network.
2018-10-18 11:47:37 +03:00
- **DEBUG** *(default: `0`)* - Enable verbose output.
2017-12-22 17:08:09 +03:00
## Quick start
2017-12-22 17:09:41 +03:00
* Instantiate your kubernetes with `--pod-network-cidr=10.244.0.0/16` flag.
2017-12-22 17:08:09 +03:00
2017-12-22 17:09:41 +03:00
* Download yaml file:
2017-12-22 17:08:09 +03:00
```
2017-12-22 19:05:35 +03:00
curl -O https://raw.githubusercontent.com/kvaps/bridget/master/bridget.yaml
2017-12-22 17:08:09 +03:00
```
2020-05-29 01:20:30 +03:00
* Edit desired parameters:
2017-12-22 17:09:41 +03:00
```
vim bridget.yaml
```
2020-05-29 01:20:30 +03:00
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.
2017-12-22 17:08:09 +03:00
* Run daemonset:
```
kubectl create -f bridget.yaml
```
2017-12-22 17:17:56 +03:00
2017-12-22 20:22:17 +03:00
## Update
* Check your `bridget.yaml` for changes.
* Run:
```
kubectl delete -f bridget.yaml
kubectl create -f bridget.yaml
```
2017-12-22 18:03:23 +03:00
## Alternatives
2020-05-29 01:20:30 +03:00
There aren't a lot of alternatives if you want to use flat L2-network with kubernetes.
2017-12-22 18:03:23 +03:00
2020-05-29 01:20:30 +03:00
Even with most of the existing solutions like [flannel](https://github.com/coreos/flannel)'s or
[romana](https://github.com/romana/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.
2017-12-22 18:03:23 +03:00
2019-12-04 17:13:34 +03:00
Bridget was created under [pipework](https://github.com/kvaps/kube-pipework)'s inspiration.
2020-05-29 01:20:30 +03:00
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.
2017-12-22 18:03:23 +03:00
2020-05-29 01:20:30 +03:00
Unlike pipework, bridget uses [CNI](https://github.com/containernetworking/cni) to configure pod interfaces.
As a result all configuration occurs automatically and kubernetes gets right IP-addresses.
2017-12-22 18:03:23 +03:00
2020-05-29 01:20:30 +03:00
Another alternative is to сreate your own CNI configuration with [bridge](https://github.com/containernetworking/plugins/tree/master/plugins/main/bridge)
or [macvlan](https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan) plugin for each of your hosts.
2017-12-22 18:03:23 +03:00
2017-12-22 17:17:56 +03:00
## Contact
* Author: [kvaps](mailto:kvapss@gmail.com)
* Bugs: [issues](https://github.com/kvaps/bridget/issues)
## Contributing
2020-05-29 01:20:30 +03:00
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.
2017-12-22 17:17:56 +03:00
## Reporting bugs
2020-05-29 01:20:30 +03:00
Please use github issue-tracker to submit bugs
2017-12-22 17:17:56 +03:00
## License
2020-05-29 01:20:30 +03:00
bridget is distributed under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.