从阿里云下载kubeadm rpm格式安装包到本地离线安装

从阿里云下载kubeadm rpm格式安装包到本地

①、配置yum源

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

②、查看有哪些版本的kubeadm
篇幅太长,只截取一部分展示

[root@k8s-01 kubeadm-devops]# yum list kubeadm --showduplicates|sort -r
 * updates: mirrors.cqu.edu.cn
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
kubeadm.x86_64                       1.9.9-0                         kubernetes 
kubeadm.x86_64                       1.9.8-0                         kubernetes 
kubeadm.x86_64                       1.9.7-0                         kubernetes 
kubeadm.x86_64                       1.9.6-0                         kubernetes 
kubeadm.x86_64                       1.9.5-0                         kubernetes 
kubeadm.x86_64                       1.9.4-0                         kubernetes 
kubeadm.x86_64                       1.9.3-0                         kubernetes 
kubeadm.x86_64                       1.9.2-0                         kubernetes 
kubeadm.x86_64                       1.9.11-0                        kubernetes 
kubeadm.x86_64                       1.9.1-0                         kubernetes 
kubeadm.x86_64                       1.9.10-0                        kubernetes 
kubeadm.x86_64                       1.9.0-0                         kubernetes 
kubeadm.x86_64                       1.8.9-0                         kubernetes 
kubeadm.x86_64                       1.8.8-0                         kubernetes 
kubeadm.x86_64                       1.8.7-0                         kubernetes 
kubeadm.x86_64                       1.8.6-0                         kubernetes 


③、修改yum.cnf 配置,以便将kubeadm.rpm下载到本地。

编辑yum.cnf文件

cachedir=/var/cache/yum #存放目录
keepcache=1 #1为保存 0为不保存

默认缓存路径:/var/cache/yum/ b a s e a r c h / basearch/ basearch/releasever

[root@k8s-01 kubeadm-devops]# cat /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

④、找一台通外网的服务器安装kubeadm 以便缓存rpm安装包

[root@k8s-01 kubeadm-devops]# yum install -y kubelet-1.18.20 kubeadm-1.18.20 kubectl-1.18.20
[root@k8s-01 kubeadm-devops]# cd /var/cache/yum/x86_64/7/kubernetes/packages/
[root@k8s-01 packages]# ls
16f7bea4bddbf51e2f5582bce368bf09d4d1ed98a82ca1e930e9fe183351a653-kubectl-1.18.20-0.x86_64.rpm
67ffa375b03cea72703fe446ff00963919e8fce913fbc4bb86f06d1475a6bdf9-cri-tools-1.19.0-0.x86_64.rpm
7b74bef0dca4f00ce1005168bdff8128479b15358b47b7f1514206789490c01a-kubeadm-1.18.20-0.x86_64.rpm
942aea8dd81ddbe1873f7760007e31325c9740fa9f697565a83af778c22a419d-kubelet-1.18.20-0.x86_64.rpm
db7cb5cb0b3f6875f54d10f02e625573988e3e91fd4fc5eef0b1876bb18604ad-kubernetes-cni-0.8.7-0.x86_64.rpm

可以将以上rpm拷贝到其他服务器执行安装。

你可能感兴趣的:(k8s,Linux运维,阿里云,kubernetes,docker)