|
1 | | -## Configuring BGP Peers |
| 1 | +# Configuring BGP Peers |
2 | 2 |
|
3 | 3 | When kube-router is used to provide pod-to-pod networking, BGP is used to exchange routes across the nodes. Kube-router |
4 | | -provides flexible networking models to support different deployment (public vs private cloud, routable vs non-routable |
5 | | -pod IP's, service ip's etc) |
| 4 | +provides flexible networking models to support different deployments (public vs private cloud, routable vs non-routable |
| 5 | +pod IP's, service ip's etc). |
6 | 6 |
|
7 | | -### Full node-to-node mesh |
| 7 | +## Peering Within The Cluster |
| 8 | +### Full Node-To-Node Mesh |
8 | 9 |
|
9 | | -This is the default mode. All nodes in the clusters form iBGP peering relationship with rest of the nodes forming full |
10 | | -node-to-node mesh. Each node advertise the pod CIDR allocated to the nodes with peers (rest of the nodes in the cluster). |
11 | | -There is no configuration required in this mode. All the nodes in the cluster are associated with private ASN 64512 |
12 | | -implicitly (which can be configured with `--cluster-asn` flag). Users are transparent to use of iBGP. This mode is |
13 | | -suitable in public cloud environments or small cluster deployments. In this mode all the nodes are expected to be L2 adjacent. |
| 10 | +This is the default mode. All nodes in the clusters form iBGP peering |
| 11 | +relationship with rest of the nodes forming full node-to-node mesh. Each node |
| 12 | +advertise the pod CIDR allocated to the nodes with peers (rest of the nodes in |
| 13 | +the cluster). There is no configuration required in this mode. All the nodes in |
| 14 | +the cluster are associated with private ASN 64512 implicitly (which can be |
| 15 | +configured with `--cluster-asn` flag). Users are transparent to use of iBGP. |
| 16 | +This mode is suitable in public cloud environments or small cluster deployments. |
| 17 | +In this mode all the nodes are expected to be L2 adjacent. |
14 | 18 |
|
15 | | -### Node specific BGP peers |
| 19 | +### Node-To-Node Peering Without Full Mesh |
16 | 20 |
|
17 | | -This model support more than a single AS per cluster to allow AS per rack or AS per node models. Nodes in the cluster |
18 | | -does not form full node-to-node mesh. Users has to explicitly select this mode by specifying `--nodes-full-mesh=false` |
19 | | -when launching kube-router. In this mode kube-router expects each node is configured with ASN number to be used for the |
20 | | -node from the nodes API object annoations. Kube-router will use the configured value for the key `net.kuberouter.nodeasn` |
21 | | -in the node object as the ASN number for the node. |
| 21 | +This model support more than a single AS per cluster to allow AS per rack or AS |
| 22 | +per node models. Nodes in the cluster does not form full node-to-node mesh. |
| 23 | +Users has to explicitly select this mode by specifying `--nodes-full-mesh=false` |
| 24 | +when launching kube-router. In this mode kube-router expects each node is |
| 25 | +configured with an ASN number from the node's API object annoations. Kube-router |
| 26 | +will use the node's `io.kube-router.net.node.asn` annotation value as the ASN |
| 27 | +number for the node. |
22 | 28 |
|
23 | | -Users can annotate node object with below command |
| 29 | +Users can annotate node objects with the following command: |
24 | 30 |
|
25 | 31 | ``` |
26 | | -kubectl annotate node <kube-node> "net.kuberouter.nodeasn=64512”" |
| 32 | +kubectl annotate node <kube-node> "io.kube-router.net.node.asn=64512" |
27 | 33 | ``` |
28 | 34 |
|
29 | | -Only nodes with in same ASN form full mesh. Two nodes with different configured ASN never gets peered. |
| 35 | +Only nodes with in same ASN form full mesh. Two nodes with different ASNs never |
| 36 | +get peered. |
30 | 37 |
|
31 | | -### Global BGP Peer |
| 38 | +## Peering Outside The Cluster |
| 39 | +### Global External BGP Peers |
32 | 40 |
|
33 | | -An optional global BGP peer can be configured by specifying `--peer-asn` and `--peer-router` parameters. When configured |
34 | | -each node in the cluster forms a peer relationship with specified global peer. Pod cidr, cluster IP's get advertised to |
35 | | -the global BGP peer. For redundancy you can also configure more than one peer router by specifying comma seperated list |
36 | | -of BGP peers for `--peer-router` flag, like `--peer-router=192.168.1.99,192.168.1.100` |
| 41 | +An optional global BGP peer can be configured by specifying `--peer-router-asns` |
| 42 | +and `--peer-router-ips` parameters. When configured each node in the cluster |
| 43 | +forms a peer relationship with specified global peer. Pod CIDR and Cluster IP's |
| 44 | +get advertised to the global BGP peer. For redundancy you can also configure |
| 45 | +more than one peer router by specifying a slice of BGP peers. |
37 | 46 |
|
38 | | -### Node specific BGP peer |
| 47 | +For example: |
| 48 | +``` |
| 49 | +--peer-router-ips="192.168.1.99,192.168.1.100" |
| 50 | +--peer-router-asns="65000,65000" |
| 51 | +``` |
| 52 | + |
| 53 | +### Node Specific External BGP Peers |
39 | 54 |
|
40 | | -Alternativley, each node can be configured with one or mode node specific BGP peer. Information regarding node specific BGP peer is |
41 | | -read from node API object annotations `net.kuberouter.node.bgppeer.address` and `net.kuberouter.node.bgppeer.asn`. |
| 55 | +Alternativley, each node can be configured with one or more node specific BGP |
| 56 | +peers. Information regarding node specific BGP peer is read from node API object |
| 57 | +annotations: |
| 58 | +- `io.kube-router.net.peer.ips` |
| 59 | +- `io.kube-router.net.peer.asns` |
42 | 60 |
|
43 | 61 |
|
44 | 62 | For e.g users can annotate node object with below commands |
45 | 63 | ``` |
46 | | -kubectl annotate node <kube-node> “net.kuberouter.node.bgppeer.address=192.168.1.98,192.168.1.99” |
47 | | -kubectl annotate node <kube-node> "net.kuberouter.node.bgppeer.asn=64513”" |
| 64 | +kubectl annotate node <kube-node> "io.kube-router.net.peer.ips=192.168.1.98,192.168.1.99" |
| 65 | +kubectl annotate node <kube-node> "io.kube-router.net.peer.asns=64513" |
| 66 | +``` |
| 67 | + |
| 68 | +### BGP Peer Password Authentication |
| 69 | + |
| 70 | +The examples above have assumed there is no password authentication with BGP |
| 71 | +peer routers. If you need to use a password for peering, you can use the |
| 72 | +`--peer-router-passwords` CLI flag or the `io.kube-router.net.peer.passwords` node |
| 73 | +annotation. |
| 74 | + |
| 75 | +#### Base64 Encoding Passwords |
| 76 | + |
| 77 | +To ensure passwords are easily parsed, but not easily read by human eyes, |
| 78 | +kube-router requires that they are encoded as base64. |
| 79 | + |
| 80 | +On a Linux or MacOS system you can encode your passwords on the command line: |
| 81 | +``` |
| 82 | +$ echo "SecurePassword" | base64 |
| 83 | +U2VjdXJlUGFzc3dvcmQK |
| 84 | +``` |
| 85 | + |
| 86 | +#### Password Configuration Examples |
| 87 | + |
| 88 | +In this CLI flag example the first router (192.168.1.99) uses a password, while |
| 89 | +the second (192.168.1.100) does not. |
| 90 | +``` |
| 91 | +--peer-router-ips="192.168.1.99,192.168.1.100" |
| 92 | +--peer-router-asns="65000,65000" |
| 93 | +--peer-router-passwords="U2VjdXJlUGFzc3dvcmQK," |
| 94 | +``` |
| 95 | + |
| 96 | +Note the comma indicating the end of the first password. |
| 97 | + |
| 98 | +Now here's the same example but configured as node annotations: |
| 99 | +``` |
| 100 | +kubectl annotate node <kube-node> "io.kube-router.net.peer.ips=192.168.1.99,192.168.1.100" |
| 101 | +kubectl annotate node <kube-node> "io.kube-router.net.peer.asns=65000,65000" |
| 102 | +kubectl annotate node <kube-node> "io.kube-router.net.peer.passwords=U2VjdXJlUGFzc3dvcmQK," |
48 | 103 | ``` |
0 commit comments