11 部署 calico 插件
当前集群已经部署完成,但是集群还没有配置网络,本教程使用 calico
作为网络插件。
在本地主机上操作。
cd /data/k8s-deploy/addons
wget https://docs.projectcalico.org/archive/v3.21/manifests/calico.yaml
sed -i 's@\(.*\)# \(- name: CALICO_IPV4POOL_CIDR\)@\1\2@' ./calico.yaml
sed -i 's@\(.*\)# value: "192.168.0.0/16"@\1 value: "172.16.0.0/12"@' ./calico.yaml
sed -i 's@docker.io/calico/cni@registry.aliyuncs.com/kubernetesz/calico-cni@' ./calico.yaml
sed -i 's@docker.io/calico/pod2daemon-flexvol@registry.aliyuncs.com/kubernetesz/calico-pod2daemon-flexvol@' ./calico.yaml
sed -i 's@docker.io/calico/node@registry.aliyuncs.com/kubernetesz/calico-node@' ./calico.yaml
sed -i 's@docker.io/calico/kube-controllers@registry.aliyuncs.com/kubernetesz/calico-kube-controllers@' ./calico.yaml
kubectl apply -f ./calico.yaml
172.16.0.0/12 是集群 Pod IP 网段
12 部署 coredns 插件
在本地主机上操作。
集群网络部署完成后,部署 dns 插件。
cd /data/k8s-deploy/addons
wget -O coredns.yaml https://raw.githubusercontent.com/kubernetes/kubernetes/v1.23.6/cluster/addons/dns/coredns/coredns.yaml.base
sed -i "s#__DNS__SERVER__#10.0.0.2#" ./coredns.yaml
sed -i "s#__DNS__MEMORY__LIMIT__#70Mi#" ./coredns.yaml
sed -i "s#__DNS__DOMAIN__#cluster.local#" ./coredns.yaml
sed -i "s#k8s.gcr.io/coredns/coredns#registry.aliyuncs.com/google_containers/coredns#" ./coredns.yaml
kubectl apply -f ./coredns.yaml
网友评论