安装
# 直接etcd认证更高性能
curl https://raw.githubusercontent.com/projectcalico/calico/v3.24.5/manifests/calico-etcd.yaml -O
# https://docs.projectcalico.org/getting-started/kubernetes/installation/config-options
这里以apiserver认证方式安装
wget https://docs.projectcalico.org/manifests/calico.yaml --no-check-certificate
修改pod网段
vim calico.yaml
POD_CIDR="172.16.0.0/12"
sed -i 's@# - name: CALICO_IPV4POOL_CIDR@- name: CALICO_IPV4POOL_CIDR@' calico.yaml
sed -i 's@# value: "192.168.0.0/16"@ value: '"$POD_CIDR"'@' calico.yaml
kubectl apply -f calico.yaml
calicoctl (可选)
wget https://github.com/projectcalico/calico/releases/download/v3.24.5/calicoctl-linux-amd64 -O /usr/local/bin/calicoctl
chmod +x /usr/local/bin/calicoctl
# 已经配置~/.kube/config,则不用配置以下两个
export KUBECONFIG=~/.kube/config # 默认路径可不用设置
export DATASTORE_TYPE=kubernetes
[root@master01 ~]# calicoctl get nodes -o wide
[root@master01 ~]# calicoctl get ippool -o wide
[root@master01 ~]# calicoctl node status
kubectl get CustomResourceDefinition
Calico配置及原理
Calico 安装配置
calico Route Reflector路由器反射
Kubernetes 网络插件 Calico 完全运维指南