1
0
Fork 0
hscloud/cluster/kube/k0.calico.yaml

79 lines
1.9 KiB
YAML
Raw Normal View History

k0.hswaw.net: pass metallb through Calico Previously, we had the following setup: .-----------. | ..... | .-----------.-| | dcr01s24 | | .-----------.-| | | dcr01s22 | | | .---|-----------| |-' .--------. | |---------. | | | dcsw01 | <----- | metallb | |-' '--------' |---------' | '-----------' Ie., each metallb on each node directly talked to dcsw01 over BGP to announce ExternalIPs to our L3 fabric. Now, we rejigger the configuration to instead have Calico's BIRD instances talk BGP to dcsw01, and have metallb talk locally to Calico. .-------------------------. | dcr01s24 | |-------------------------| .--------. |---------. .---------. | | dcsw01 | <----- | Calico |<--| metallb | | '--------' |---------' '---------' | '-------------------------' This makes Calico announce our pod/service networks into our L3 fabric! Calico and metallb talk to eachother over 127.0.0.1 (they both run with Host Networking), but that requires one side to flip to pasive mode. We chose to do that with Calico, by overriding its BIRD config and special-casing any 127.0.0.1 peer to enable passive mode. We also override Calico's Other Bird Template (bird_ipam.cfg) to fiddle with the kernel programming filter (ie. to-kernel-routing-table filter), where we disable programming unreachable routes. This is because routes coming from metallb have their next-hop set to 127.0.0.1, which makes bird mark them as unreachable. Unreachable routes in the kernel will break local access to ExternalIPs, eg. register access from containerd. All routes pass through without route reflectors and a full mesh as we use eBGP over private ASNs in our fabric. We also have to make Calico aware of metallb pools - otherwise, routes announced by metallb end up being filtered by Calico. This is all mildly hacky. Here's hoping that Calico will be able to some day gain metallb-like functionality, ie. IPAM for externalIPs/LoadBalancers/... There seems to be however one problem with this change (but I'm not fixing it yet as it's not critical): metallb would previously only announce IPs from nodes that were serving that service. Now, however, the Calico internal mesh makes those appear from every node. This can probably be fixed by disabling local meshing, enabling route reflection on dcsw01 (to recreate the mesh routing through dcsw01). Or, maybe by some more hacking of the Calico BIRD config :/. Change-Id: I3df1f6ae7fa1911dd53956ced3b073581ef0e836
2020-09-20 22:52:57 +00:00
# This is the current Calico configuration in k0.hswaw.net.
# Unfortunately, we do not have Calico configured to use CRDs, and instead to
# keep its resources separately from Kubernetes. Thus, this configuration
# cannot be managed by Kubernetes/jsonnet. Instead, it must be applied manially:
#
# calicoctl apply -f k0.calico.yaml
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
name: default
spec:
logSeverityScreen: Info
nodeToNodeMeshEnabled: true
asNumber: 65003
---
# metallb peer, must be compatible with the metallbc definition in k0.libsonnet.
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: metallb
spec:
peerIP: 127.0.0.1
asNumber: 65002
---
# ToR switch peering, must be compatible with the configuration on dcsw01.hswaw.net.
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: dcsw01
spec:
peerIP: 185.236.240.33
asNumber: 65001
---
# IP pool that's used by metallb. We mark it as disabled so that Calico doesn't
# allocate Service IPs from it, just allow metallb routes from that pool to
# pass through eBGP (otherwise Calico BIRD filter will filter them out).
# Keep in sync with k0.libsonnet.
apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
name: public-v4-1
spec:
cidr: 185.236.240.48/28
disabled: true
---
# IP pool that's used by metallb. We mark it as disabled so that Calico doesn't
# allocate Service IPs from it, just allow metallb routes from that pool to
# pass through eBGP (otherwise Calico BIRD filter will filter them out).
# Keep in sync with k0.libsonnet.
apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
name: public-v4-2
spec:
cidr: 185.236.240.112/28
disabled: true
---
# IP pool for the service network.
apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
name: default-ipv4-ippool
spec:
blockSize: 26
cidr: 10.10.24.0/21
ipipMode: CrossSubnet
natOutgoing: true