您好,登錄后才能下訂單哦!
這篇文章主要講解了“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。