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
文章来源地址https://www.toymoban.com/news/detail-737931.html
文章来源:https://www.toymoban.com/news/detail-737931.html
到了这里,关于K8S添加yum源并安装kubectl/kubeadm/kubelet组件的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!