安裝參照文檔:
https://v1-18.docs.kubernetes.io/zh/docs/setup/independent/install-kubeadm/
1.swapoff -a 關(guān)閉swap
2.kubeadm init使用的國外源,所以下載會超時。
所以需要指定鏡像使用阿里云鏡像:
kubeadm init --image-repository registry.aliyuncs.com/google_containers
3.安裝結(jié)束后,master節(jié)點為NotReady,需要安裝網(wǎng)絡(luò)插件
docker pull quay.io/coreos/flannel:v0.10.0-amd64
mkdir -p /etc/cni/net.d/
cat <<EOF> /etc/cni/net.d/10-flannel.conf
{"cniVersion":"0.2.0","name":"cbr0","type":"flannel","delegate": {"isDefaultGateway": true}}
EOF
mkdir /usr/share/oci-umount/oci-umount.d -p
mkdir /run/flannel/
cat <<EOF> /run/flannel/subnet.env
FLANNEL_NETWORK=172.100.0.0/16
FLANNEL_SUBNET=172.100.1.0/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
EOF
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml
過程可參照
https://blog.csdn.net/wangmiaoyan/article/details/101216496
error:
1 node(s) had taints that the pod didn't tolerate
master node參與工作負(fù)載 (只在主節(jié)點執(zhí)行)
使用kubeadm初始化的集群,出于安全考慮Pod不會被調(diào)度到Master Node上,也就是說Master Node不參與工作負(fù)載。
允許master進(jìn)行部署:
kubectl taint nodes --all node-role.kubernetes.io/master-