官网文档:为本地部署安装 Calico 网络和网络策略 |Calico 文档 --- Install Calico networking and network policy for on-premises deployments | Calico Documentation (tigera.io)

下载calico清单文件

curl https://raw.githubusercontent.com/projectcalico/calico/v3.28.0/manifests/calico.yaml -O

查看cluster-cidr

# 查看pod subnet,设置网络组件时须保持一致
cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep "cluster-cidr"
# 查看service subnet,这一步不需要,只记录
cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep "service-cluster"

修改yaml文件

支持IPv4/IPv6双协议栈

vim calico.yaml

部署calico

kubectl apply -f calico.yaml