Created
March 9, 2019 03:06
-
-
Save zimmertr/81e71bf83563d3ede8139fd925fc50c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Configure BGP on your router and configure each of your Kubernetes worker nodes as a neighbor. Remember the AS that you use. For example on my `Ubiquiti EdgeRouter Lite` | |
``` | |
ssh tj@sol | |
configure | |
set protocols bgp 1 parameters router-id 192.168.1.1 | |
set protocols bgp 1 neighbor 192.168.40.100 remote-as 1 | |
set protocols bgp 1 neighbor 192.168.40.101 remote-as 1 | |
set protocols bgp 1 neighbor 192.168.40.102 remote-as 1 | |
set protocols bgp 1 redistribute static | |
commit; save | |
``` | |
Now I'll read the BGP configuration on my router and ensure that the state for each neighbor is "Active". Meaning it's configured and waiting for a connection to the neighbor. | |
``` | |
root@sol:/home/tj# show ip bgp neighbors | grep state | |
BGP state = Active | |
BGP state = Active | |
BGP state = Active | |
``` | |
2) Deploy MetalLB to your Kubernetes cluster | |
``` | |
kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.7.3/manifests/metallb.yaml | |
``` | |
3) Create a ConfigMap to configure MetalLB to peer with your router. | |
``` | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
namespace: metallb-system | |
name: config | |
data: | |
config: | | |
peers: | |
- peer-address: 192.168.1.1 | |
peer-asn: 1 | |
my-asn: 1 | |
address-pools: | |
- name: VLAN20 | |
protocol: bgp | |
addresses: | |
- 192.168.20.0/24 | |
- name: VLAN50 | |
protocol: bgp | |
addresses: | |
- 192.168.50.0/24 | |
- name: VLAN60 | |
protocol: bgp | |
addresses: | |
- 192.168.60.0/24 | |
- name: VLAN70 | |
protocol: bgp | |
addresses: | |
- 192.168.70.0/24 | |
``` | |
4) Apply the configmap to Kubernetes and check the state of each neighbor from your router again to ensure that the connection has became `Established`. | |
``` | |
kubectl apply -f config.yaml | |
``` | |
``` | |
root@sol:/home/tj# show ip bgp neighbors | grep state | |
BGP state = Established, up for 00:00:53 | |
BGP state = Established, up for 00:00:53 | |
BGP state = Established, up for 00:00:53 | |
``` | |
5) Your configuration might look like this: | |
``` | |
root@sol# show protocols bgp 1 | |
neighbor 192.168.40.100 { | |
remote-as 1 | |
} | |
neighbor 192.168.40.101 { | |
remote-as 1 | |
} | |
neighbor 192.168.40.102 { | |
remote-as 1 | |
} | |
parameters { | |
router-id 192.168.1.1 | |
} | |
redistribute { | |
static { | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment