K8S添加yum源并安装kubectl/kubeadm/kubelet组件

1.安装kubectl/kubeadm/kubelet

##添加yum 源
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

#列出kubectl可用的版本
yum clean all && yum makecache -y
yum list kubectl --showduplicates | sort -r 

#ubuntu系统安装命令
sudo apt install kubelet=1.23.8-00 kubeadm=1.23.8-00 kubectl=1.23.8-00 -y #指定版本,最新版本拉去镜像有问题

sudo apt-mark hold kubelet kubeadm kubectl
sudo systemctl enable kubelet.service
sudo systemctl restart kubelet.service

##centos系统安装命令
yum -y install kubelet-1.23.8-0 kubeadm-1.23.8-0 kubectl-1.23.8-0
systemctl enable kubelet

2.安装K8S

##只在master上执行
kubeadm init --apiserver-advertise-address=192.168.186.128  --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.23.8 --service-cidr=10.96.0.0/12  --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=all

你可能感兴趣的:(kubernetes,kubernetes,kubelet,容器)