An init container that configures a Kubernetes node to act as a Calico BGP route reflector.
1.2K
An init container that configures a Kubernetes node to act as a Calico BGP route reflector.
The container performs two tasks that automates the configuration of a node for route reflection:
BGPPeer resources to indicate which nodes should (or should not) peer with this node.For a detailed explanation of how route reflectors are configured, see configuring in-cluster route reflectors.
This should be used as an init container for the calico-node daemonset that will be acting as both a calico-node and a route reflector, thus we recommend two sepearate daemonsets of calico-node:
In this example, we're configuring the masters to be our route reflectors, as part of the choose and labels nodes section of Calico the hard way.
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: calico-node-master
namespace: kube-system
spec:
...
template:
...
spec:
...
nodeSelector:
# Run calico-node-master on masters only.
node-role.kubernetes.io/master: ""
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
initContainers:
- name: configure-route-reflector
image: zappi/calico-route-reflector-init:0.1.0
env:
# Use the Downward API set the node name.
- name: KUBERNETES_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CALICO_ROUTE_REFLECTOR_LABEL_NAME
value: "calico-route-reflector"
- name: CALICO_ROUTE_REFLECTOR_CLUSTER_ID
value: "1.1.1.1"
Since our masters are already running their own calico-node, we must ensure that our second daemonset only runs on worker nodes.
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: calico-node
namespace: kube-system
...
spec:
...
template:
...
spec:
...
nodeSelector:
# Run calico-node on workers only.
node-role.kubernetes.io/node: ""
Once the two daemonsets are up and running, you can move on to the next step, configuring your peering.
| Name | Description | Example | Required |
|---|---|---|---|
KUBERNETES_NODE_NAME | The name of the node to be labelled and annotated. | ip-10-24-101-78.ec2.internal | Yes |
CALICO_ROUTE_REFLECTOR_LABEL_NAME | The name of the label to be used for peering configuration. | calico-route-reflector | Yes |
CALICO_ROUTE_REFLECTOR_LABEL_VALUE | The value of the label to be used for peering configuration. | true | No |
CALICO_ROUTE_REFLECTOR_CLUSTER_ID | The cluster identifier to use when annotating the node as a route reflector. | 224.0.0.1 | Yes |
We should be able to support Calico 3.3.0 and later.
Content type
Image
Digest
Size
16.5 MB
Last updated
almost 7 years ago
docker pull zappi/calico-route-reflector-init