配置源
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker- ce.repo -O /etc/yum.repos.d/docker-ce.repo
# yum install --setopt=obsoletes=0 docker-ce-18.06.3.ce-3.el7 -y //指定版本yum install docker-ce //选择其一进行安装
添加配置文件
cat /etc/docker/daemon.json{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://kn0t2bca.mirror.aliyuncs.com"]
}
yum localinstall cri-dockerd-0.2.3-3.el7.x86_64.rpm
修改配置文件/usr/lib/systemd/system/cri-docker.service
ExecStart=/usr/bin/cri-dockerd --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.7
启动cri-docker
systemctl daemon-reloadsystemctl enable cri-docker --now
集群初始化,在master节点上做
kubeadm init --kubernetes-version=v1.24.2 --pod-network-cidr=10.224.0.0/16 --apiserver-advertise-address=192.168.40.132 --cri-socket unix:///var/run/cri-dockerd.sock --image-repository registry.aliyuncs.com/google_containers
然后在node1和node2上面做
kubeadm join 192.168.40.132:6443 --token 56622b.1i9erjpt334z56eh --discovery-token-ca-cert-hash sha256:0e049eb92a04b40d0051291419c01645a029e3795730bb49a67dc810ec5d6d25 --cri-socket unix:///var/run/cri-dockerd.sock
wget http://down.i4t.com/k8s1.24/kube-flannel.ymlkubectl apply -f kube-flannel.yml