Created
February 7, 2025 06:22
-
-
Save jxlwqq/b86be764398d1ed39ca49820b025c54c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calico | |
#### 拉取镜像 | |
```shell | |
nerdctl image pull --namespace=k8s.io quay.io/tigera/operator:v1.30.3 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/cni:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/node:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/kube-controllers:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/csi:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/apiserver:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/pod2daemon-flexvol:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/typha:v3.26.0 | |
nerdctl image pull --namespace=k8s.io m.daocloud.io/docker.io/calico/node-driver-registrar:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/cni:v3.26.0 docker.io/calico/cni:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/node:v3.26.0 docker.io/calico/node:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/kube-controllers:v3.26.0 docker.io/calico/kube-controllers:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/csi:v3.26.0 docker.io/calico/csi:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/apiserver:v3.26.0 docker.io/calico/apiserver:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/pod2daemon-flexvol:v3.26.0 docker.io/calico/pod2daemon-flexvol:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/typha:v3.26.0 docker.io/calico/typha:v3.26.0 | |
nerdctl image tag --namespace=k8s.io m.daocloud.io/docker.io/calico/node-driver-registrar:v3.26.0 docker.io/calico/node-driver-registrar:v3.26.0 | |
``` | |
nerdctl save --namespace=k8s.io quay.io/tigera/operator:v1.30.3 >images/tigera-operator-v1.30.3.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/cni:v3.26.0 >images/calico-cni-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/node:v3.26.0 >images/calico-node-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/kube-controllers:v3.26.0 >images/calico-kube-controllers-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/csi:v3.26.0 >images/calico-csi-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/apiserver:v3.26.0 >images/calico-apiserver-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/pod2daemon-flexvol:v3.26.0 >images/calico-pod2daemon-flexvol-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/typha:v3.26.0 >images/calico-typha-v3.26.0.tar | |
nerdctl save --namespace=k8s.io docker.io/calico/node-driver-registrar:v3.26.0 >images/calico-node-driver-registrar-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/tigera-operator-v1.30.3.tar | |
nerdctl load --namespace=k8s.io <images/calico-cni-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-node-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-kube-controllers-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-csi-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-apiserver-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-pod2daemon-flexvol-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-typha-v3.26.0.tar | |
nerdctl load --namespace=k8s.io <images/calico-node-driver-registrar-v3.26.0.tar | |
``` | |
#### 安装 calicoctl | |
```shell | |
# node-0 | |
curl -LO https://github.com/projectcalico/calico/releases/download/v3.26.0/calicoctl-linux-amd64 | |
chmod +x ./calicoctl-linux-amd64 | |
cp ./calicoctl-linux-amd64 /usr/local/bin/calicoctl | |
``` | |
#### 安装 Calico | |
```shell | |
kubectl create ns calico-system | |
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/tigera-operator.yaml | |
kubectl -n tigera-operator set image deployments/tigera-operator tigera-operator=quay.io/tigera/operator:v1.30.3 | |
``` | |
#### 使用 VXLAN 模式 | |
```shell | |
curl https://raw.githubusercontent.com/projectcalico/calico/v3.26.0/manifests/custom-resources.yaml -O | |
kubectl apply -f custom-resources.yaml | |
``` | |
#### 调整 Calico 配置 | |
```shell | |
# waiting for calico ready | |
watch kubectl get pods -A -o wide | |
# 关闭 IPIP 模式 | |
# VXLAN or BGP without encapsulation is supported if using Calico CNI. IPIP (Calico's default encapsulation mode) is not supported. Use the following command to turn off IPIP on the default IP pool. | |
# https://docs.tigera.io/calico/3.26/getting-started/kubernetes/windows-calico/kubernetes/requirements | |
kubectl patch felixconfiguration default --type=merge --patch='{"spec":{"ipipEnabled":false}}' | |
# IPAM 配置的严格关联性设置为 true | |
# For Linux control nodes using Calico networking, strict affinity must be set to true. This is required to prevent Linux nodes from borrowing IP addresses from Windows nodes: | |
# https://docs.tigera.io/calico/3.26/getting-started/kubernetes/windows-calico/kubernetes/standard | |
kubectl patch ipamconfigurations default --type=merge --patch='{"spec": {"strictAffinity": true}}' | |
# 禁用 BGP | |
# Ensure that BGP is disabled since you're using VXLAN. If you installed Calico using operator, you can do this by: | |
# https://docs.tigera.io/calico/3.26/getting-started/kubernetes/windows-calico/quickstart | |
kubectl patch installation default --type=merge --patch='{"spec": {"calicoNetwork": {"bgp": "Disabled"}}}' | |
``` | |
https://docs.tigera.io/calico/latest/getting-started/kubernetes/self-managed-onprem/onpremises |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linux
登陆虚拟机
设置密码并使用 root 用户
sudo passwd root su root cd /vagrant
禁用交换分区和防火墙
sudo swapoff -a sudo sed -ri 's/.*swap.*/#&/' /etc/fstab sudo ufw disable
配置网络
安装容器运行时
使用推荐的 containerd 作为容器运行时,详见:
https://github.com/containerd/containerd/blob/main/docs/getting-started.md
安装 kubeadm、kubelet 和 kubectl
安装 nerdctl,并提前下载镜像
初始化 control-plane 节点
仅在 control-plane 节点执行:
加入 node 节点
仅在 node 节点执行:
修改 node 节点的 kubelet 配置
上述操作尽限本地 vagrant 环境,线下/生产环境无需修改。