您好,登录后才能下订单哦!
这篇文章主要讲解了“Kubernetes镜像的离线保存和载入方法是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Kubernetes镜像的离线保存和载入方法是什么”吧!
把Kubernetes的镜像离线保存到文件,然后从文件载入就可以实现离线安装了(非常快)。
这里使用的Kubernetes 1.12.1版本的镜像,其它版本修改对应的版本号即可。
使用docker save命令来保存docker images到文件,-o 参数指示文件名。
运行下面的脚本之前,建议为镜像文件建立一个单独的目录。
如下:
echo "===================================================================" echo "Save Kubernetes images to tar." echo "This tool created by https://my.oschina.net/u/2306127" echo "Please visit https://github.com/openthings/kubernetes-tools" echo "###################################################################" echo "Kubernetes core system images." echo "-------------------------------------------------------------------" echo "A1.>> k8s.gcr.io/kube-apiserver:v1.12.1" sudo docker save k8s.gcr.io/kube-apiserver:v1.12.1 -o A1-k8s-kube-apiserver-v1.12.1.tar echo "" echo "A2.>> k8s.gcr.io/kube-controller-manager:v1.12.1" sudo docker save k8s.gcr.io/kube-controller-manager:v1.12.1 -o A2-k8s-kube-controller-manager-v1.12.1.tar echo "" echo "A3.>> k8s.gcr.io/kube-scheduler:v1.12.1" sudo docker save k8s.gcr.io/kube-scheduler:v1.12.1 -o A3-k8s-kube-scheduler-v1.12.1.tar echo "" echo "A4.>> k8s.gcr.io/kube-proxy:v1.12.1" sudo docker save k8s.gcr.io/kube-proxy:v1.12.1 -o A4-k8s-kube-proxy-v1.12.1.tar echo "" echo "A5.>> k8s.gcr.io/pause:3.1" sudo docker save k8s.gcr.io/pause:3.1 -o A5-k8s-pause-3.1.tar echo "" echo "A6.>> k8s.gcr.io/etcd:3.2.24" sudo docker save k8s.gcr.io/etcd:3.2.24 -o A6-k8s-etcd-3.2.24.tar echo "" echo "A7.>> k8s.gcr.io/coredns:1.2.2" sudo docker save k8s.gcr.io/coredns:1.2.2 -o A7-k8s-coredns-1.2.2.tar echo "" echo "===================================================================" echo "B1.>> quay.io/coreos/flannel:v0.10.0-amd64" sudo docker save quay.io/coreos/flannel:v0.10.0-amd64 -o B1-flannel-v0.10.0.tar echo "" echo "B2.>> k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0" sudo docker save k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0 -o B2-dashboard-v1.10.0.tar echo "" echo "B3.>> gcr.io/kubernetes-helm/tiller:v2.11.0" sudo docker save gcr.io/kubernetes-helm/tiller:v2.11.0 -o B3-helm-tiller-v2.11.0.tar echo "" echo "B4.>> quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.14.0" sudo docker save quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.14.0 -o B4-ingress-controller-0.14.0.tar echo "" echo "B5.>> k8s.gcr.io/defaultbackend:1.3" sudo docker save k8s.gcr.io/defaultbackend:1.3 -o B5-k8s-defaultbackend-1.3.tar echo "" echo "===================================================================" echo "Save kubernetes images Finished." echo "This tool created by https://my.oschina.net/u/2306127" echo "Please visit https://github.com/openthings/kubernetes-tools" echo "===================================================================" echo ""
上面的A*为Kubernetes系统镜像,B*为几个常用的扩展模块的镜像。如果还需要其它镜像,仿照上面编写脚本即可。
保存为文件k8s-images-save.sh,然后执行。
使用U盘或网络或者其它网络,传送images到任何地方。
初始镜像的建立请参考《Kubernetes 1.12.1快速升级》,可以从我建的镜像仓库下载。
IPFS, https://ipfs.io /ipfs/QmUTm9wHwXcwHNzp7Yv9XtrRq5kr9iwGfdh2XdG25NEg5b k8s-images-1.12.1.zip
Test IPFS http://127.0.0.1:8080/ipfs/QmZP1Gk88qdijGLg8L2NiB6ZqhK4HsUN39DsEdH5rxn9C8
http://127.0.0.1:8080/ipfs/QmSDhnmQ3oJWpiC1V4DnU7714L6qYUC7JBB4oRLMLLGGYa/Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack
http://127.0.0.1:8080/ipfs/QmSDhnmQ3oJWpiC1V4DnU7714L6qYUC7JBB4oRLMLLGGYa
网盘下载(带解压复原脚本), https://pan.baidu.com/s/1Eo0PAAGcIxOQqHn-QwhDeA
使用压缩包里面的脚本 k8s-images-load.sh,可以快速复原镜像到docker images。
使用docker load命令来从文件载入docker images,-i 参数指示源文件名。如下:
echo "===================================================================" echo "Load Kubernetes images from tar." echo "This tool created by https://my.oschina.net/u/2306127" echo "Please visit https://github.com/openthings/kubernetes-tools" echo "###################################################################" echo "Kubernetes core system images." echo "-------------------------------------------------------------------" echo "A1<< k8s.gcr.io/kube-apiserver:v1.12.1" sudo docker load -i A1-k8s-kube-apiserver-v1.12.1.tar echo "" echo "A2<< k8s.gcr.io/kube-controller-manager:v1.12.1" sudo docker load -i A2-k8s-kube-controller-manager-v1.12.1.tar echo "" echo "A3<< k8s.gcr.io/kube-scheduler:v1.12.1" sudo docker load -i A3-k8s-kube-scheduler-v1.12.1.tar echo "" echo "A4<< k8s.gcr.io/kube-proxy:v1.12.1" sudo docker load -i A4-k8s-kube-proxy-v1.12.1.tar echo "" echo "A5<< k8s.gcr.io/pause:3.1" sudo docker load -i A5-k8s-pause-3.1.tar echo "" echo "A6<< k8s.gcr.io/etcd:3.2.24" sudo docker load -i A6-k8s-etcd-3.2.24.tar echo "" echo "A7<< k8s.gcr.io/coredns:1.2.2" sudo docker load -i A7-k8s-coredns-1.2.2.tar echo "" echo "===================================================================" echo "B1<< quay.io/coreos/flannel:v0.10.0-amd64" sudo docker load -i B1-flannel-v0.10.0.tar echo "" echo "B2<< k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0" sudo docker load -i B2-dashboard-v1.10.0.tar echo "" echo "B3<< gcr.io/kubernetes-helm/tiller:v2.11.0" sudo docker load -i B3-helm-tiller-v2.11.0.tar echo "" echo "B4<< quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.14.0" sudo docker load -i B4-ingress-controller-0.14.0.tar echo "" echo "B5<< k8s.gcr.io/defaultbackend:1.3" sudo docker load -i B5-k8s-defaultbackend-1.3.tar echo "" echo "===================================================================" echo "Load kubernetes images Finished." echo "This tool created by https://my.oschina.net/u/2306127" echo "Please visit https://github.com/openthings/kubernetes-tools" echo "==================================================================="
保存为文件k8s-images-load.sh,然后执行。
感谢各位的阅读,以上就是“Kubernetes镜像的离线保存和载入方法是什么”的内容了,经过本文的学习后,相信大家对Kubernetes镜像的离线保存和载入方法是什么这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。