When your on-premises data center uses a BGP network, hybrid cloud scenarios require BGP Peer mode and BGP-capable switches and routers. Calico supports both overlay and BGP networking. This topic explains how to configure Calico BGP networking for on-premises Kubernetes clusters.
BGP Peer mode requires all switches and routers in your data center to support BGP.
Prerequisites
Ensure that you have:
-
A Kubernetes cluster running in your data center with Calico installed.
-
Your data center connected to Alibaba Cloud via Cloud Enterprise Network (CEN).
Architecture overview
How a data center connects to Alibaba Cloud:
Configure BGP peering
Install calicoctl
Install calicoctl on your master node.
Apply BGP configuration
Step 2a: Disable node-to-node mesh and set the AS number
Apply this BGPConfiguration. Replace asNumber with your data center's AS number.
kubectl apply -f - << EOF
apiVersion: projectcalico.org/v3
kind: BGPConfiguration
metadata:
name: default
spec:
logSeverityScreen: Info
nodeToNodeMeshEnabled: false
asNumber: 64513
EOF
| Parameter | Description | Example |
|---|---|---|
nodeToNodeMeshEnabled |
Whether to enable full BGP mesh between all nodes. Set to false for external router peering. |
false |
asNumber |
The Autonomous System (AS) number for your data center. | 64513 |
logSeverityScreen |
BGP log verbosity. Info is recommended for production. |
Info |
Step 2b: Create a global BGP peer
Apply this BGPPeer resource. Replace peerIP and asNumber with your data center values.
kubectl apply -f - << EOF
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: my-global-peer
spec:
peerIP: 192.168.0.1
asNumber: 64513
EOF
| Parameter | Description | Example |
|---|---|---|
peerIP |
IP address of the BGP peer (switch or router). | 192.168.0.1 |
asNumber |
The AS number for BGP peering. | 64513 |
Verify BGP peering
Verify the BGP session is established using either method.
Option 1: Use calicoctl
On the master node:
[root@master ~]# ./calicoctl node status
Calico process is running.
IPv4 BGP status
+--------------+-----------+-------+----------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+--------------+-----------+-------+----------+-------------+
| 192.168.0.1 | global | up | 03:38:03 | Established |
+--------------+-----------+-------+----------+-------------+
IPv6 BGP status
No IPv6 peers found.
The BGP session is active when STATE shows up and INFO shows Established.
Option 2: Check the VPC route table
-
Log on to the VPC console.
-
In the left-side navigation pane, click Route Tables.
-
On the Route Tables page, click the target route table.
-
Click Route Entry List > Cloud Enterprise Network and verify that a route entry is added.