Certified Calico Operator: Level 1 笔记
证书课程地址:Course | CCO-L1 | Tigera还有一份可能有用的电子书: Tigera_eBook_Intro_to_Kubernetes_Networking.pdf
Kubernetes Network Model
- 每个 Pod 都有一个 IP 地址;
- 同一个 Pod 中的容器共享同一 IP 地址,并能通过该地址相互通信;
- Pod 与 Pod 之间可以通过 IP 通信(无需地址转换);
- 网络隔离可以限制哪里 Pod 可以访问哪些不可以。

安装测试集群
curl https://raw.githubusercontent.com/tigera/ccol1/main/control-init.yaml | multipass launch -n control -m 2048M 20.04 --cloud-init -
curl https://raw.githubusercontent.com/tigera/ccol1/main/node1-init.yaml | multipass launch -n node1 20.04 --cloud-init -
curl https://raw.githubusercontent.com/tigera/ccol1/main/node2-init.yaml | multipass launch -n node2 20.04 --cloud-init -
curl https://raw.githubusercontent.com/tigera/ccol1/main/host1-init.yaml | multipass launch -n host1 20.04 --cloud-init -
重启系统后,可能需要启动所有的虚拟机
multipass start --all
安装 Calico
4 种安装方式
- Manifest
- Operator
- Managed Kubernetes Services
- Kubernetes Distros and Installers
Operator 方式安装
可参考:Quickstart for Calico on Kubernetes注意事项:
- Pod 的网段
- calico 版本与 kubernetes 版本之间的兼容关系(最好就用教程里面的安装命令)
kubectl create -f https://docs.projectcalico.org/archive/v3.21/manifests/tigera-operator.yaml
cat <<EOF | kubectl apply -f -
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
calicoNetwork:
containerIPForwarding: Enabled
ipPools:
- cidr: 198.19.16.0/20
natOutgoing: Enabled
encapsulation: None
EOF
删除 tigera-operator 命名空间
curl -H "Content-Type: application/json" \
-XPUT \
-d '{"apiVersion":"v1","kind":"Namespace","metadata":{"name":"tigera-operator"},"spec":{"finalizers":[]}}' \
http://localhost:8001/api/v1/namespaces/tigera-operator/finalize
相关 Pod 的工作内容:
tigera-operator/tigera-operator-xxxx-xxx
监听 Installation CR,并按照配置安装 calico CNI。
- calico-system/calico-node
DaemonSet,网络策略实现;设置Node节点上的路由;为 IPIP、VXLAN、WireGuard 管理虚拟接口。
- calico-system/calico-typha
StatefulSet,作为 calico-node 用来查询、监听 api-server 时的缓存层,避免直接访问 api-server。它由 tigera-operator 来随着 node 的变化,进行扩缩容。
- calico-system/calico-controller
calico 的各种 controller 集合,用于自动同步资源状态。