1 添加 ippool

1.1 配置 ippool

以clusterA集群为例子,此操作也要在clusterB 执行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 在 clusterA 集群执行
# 导出配置文件
calicoctl get ippool default-ipv4-ippool -o yaml > clusterA-ippool.yaml

# 修改配置文件
vim clusterA-ippool.yaml
apiVersion: projectcalico.org/v3
items:
- apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
name: clusterA-ipv4-ippool 修改名称
spec:
allowedUses:
- Workload
- Tunnel
blockSize: 26
cidr: 192.168.0.0/16
disabled: true # 添加
ipipMode: CrossSubnet
natOutgoing: true
nodeSelector: all()
vxlanMode: Never
kind: IPPoolList

#拷贝到 clusterA 集群执行
calicoctl apply -f clusterA-ippool.yaml

1.2 查看

1.2.1 clusterA 集群

1
2
3
4
calicoctl get ippool -o wide
NAME CIDR NAT IPIPMODE VXLANMODE DISABLED DISABLEBGPEXPORT SELECTOR
default-ipv4-ippool 192.168.0.0/16 true CrossSubnet Never false false all()
clusterB-ipv4-ippool 172.16.0.0/16 true Always Never true false all()

1.2.2 clusterB 集群

1
2
3
4
get ippool -o wide
NAME CIDR NAT IPIPMODE VXLANMODE DISABLED DISABLEBGPEXPORT SELECTOR
clusterA-ipv4-ippool 192.168.0.0/16 true CrossSubnet Never true false all()
default-ipv4-ippool 172.16.0.0/16 true Always Never false false all()

2 BGP 对等体配置

以clusterA集群为例子,此操作也要在clusterB 执行,如果需要高可用需要加多个对等体

1
2
3
4
5
6
7
8
apiVersion: projectcalico.org/v3
kind: BGPPeer
metadata:
name: clusterb-global-peer1
spec:
node: clusterBmaster1
peerIP: 10.0.0.1
asNumber: 63456 # 通过 `calicoctl get BGPConfiguration` 查看

2.1 查看

10.0.0.1为clusterB 集群的 master 节点

1
2
3
4
5
6
7
8
9
10
11
calicoctl node status
Calico process is running.

IPv4 BGP status
+----------------+---------------+-------+----------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+----------------+---------------+-------+----------+-------------+
| 10.1.1.1 | node specific | up | 06:54:15 | Established |
| 10.1.1.1 | node specific | up | 06:54:15 | Established |
| 10.0.0.1 | node specific | up | 07:36:05 | Established |
+----------------+---------------+-------+----------+-------------+

3 问题记录

3.1 获取不到另一个 集群路由

1
2
# 测试配置对等体的端口
telnet 10.0.0.1 179