About the AuthorWang Hailong, SUSE/Rancher China Community Technical Manager, responsible for the maintenance and operation of the Rancher China Technical Community. He has 7 years of experience in the field of cloud computing, and has experienced technological changes from OpenStack to Kubernetes. He has rich operation and maintenance and practical experience no matter the underlying operating system Linux, virtualized KVM or Docker container technology.
Preface
Offline installation and deployment can allow enterprises to run Rancher smoothly in the internal network environment, but when Rancher is installed offline in the domestic network environment, it takes a long time to download the required image due to the large image itself and the influence of the network.
rancher-images.txt provided by Rancher has 100+ mirror images, and the compressed size is almost 8G. Release from Rancher ( https://github.com/rancher/rancher/releases downloaded) rancher-save-images.sh default image taken from dockerhub pull. If all images are downloaded from dockerhub, it will be a very difficult task.
To further enhance the domestic user experience, Rancher for the domestic environment to do some optimization, in rancher-save-images.sh increases in the --from-aliyun to true parameters, to support the country's Ali cloud images from the warehouse to pull Take the rancher-images.txt .
Note:
- Starting from Rancher v2.4.15 and v2.5.8, the --from-aliyun true parameter is supported.
- rancher-save-images.sh downloaded from the Rancher release, not currently supported **--from-aliyun
true** parameter. - Support the --from-aliyun to true parameters rancher-save-images.sh from http://mirror.rancher.cn -> Rancher get.
Steps
1, for support the --from-aliyun to true parameters rancher-save-images.sh
Browser access http://mirror.rancher.cn , then navigate to the rancher directory, select the corresponding rancher version, and download rancher-save-images.sh. rancher-images.txt and rancher-load-images.sh can be downloaded from http://mirror.rancher.cn or Rancher release, no difference.
2. Pull the image from the Alibaba Cloud mirror warehouse and package it
root@ip-172-31-21-94:~/image# ./rancher-save-images.sh -h
USAGE: ./rancher-save-images.sh [--image-list rancher-images.txt] [--images rancher-images.tar.gz] [--from-aliyun true]
[-l|--image-list path] text file with list of images; one image per line.
[-i|--images path] tar.gz generated by docker save.
[--from-aliyun true|false] get an image from aliyun
[-h|--help] Usage message
root@ip-172-31-21-94:~/image#
root@ip-172-31-21-94:~/image# ./rancher-save-images.sh --from-aliyun true
Image pull success: registry.cn-hangzhou.aliyuncs.com/rancher/busybox
Image pull success: registry.cn-hangzhou.aliyuncs.com/rancher/backup-restore-operator:v1.0.4-rc4
Image pull success: registry.cn-hangzhou.aliyuncs.com/rancher/cis-operator:v1.0.4
Image pull success: registry.cn-hangzhou.aliyuncs.com/rancher/configmap-reload:v0.3.0-rancher4
Image pull success: registry.cn-hangzhou.aliyuncs.com/rancher/coredns-coredns:1.6.2
...
It can be seen from the above log that the use of --from-aliyun true specifies to pull the image from the Alibaba Cloud mirror warehouse, which is N times faster than pulling the image from dockerhub.
After the script is executed successfully, the image compression package of rancher-images.tar.gz
3. Push the mirror to the private mirror library
In this step, you will use the script to rancher-images.tar.gz to your own private image library.
The files rancher-images.txt and rancher-images.tar.gz should be in the same directory as the rancher-load-images.sh
Log in to the private mirror library
docker login harbor.kingsd.top
Push mirror
./rancher-load-images.sh --registry harbor.kingsd.top
After the execution is successful, you can see in the private mirror warehouse that all the mirrors required by Rancher have been uploaded.
postscript
The operation steps of this article are basically the same as the offline installation of Rancher official documents, except that in this article, http://mirror.rancher.cn 1609fc5dc024ef, and rancher-save-images.sh is executed. Added the --from-aliyun true parameter to specify download from the Aliyun mirror warehouse.
I hope this article can greatly improve the offline installation experience of Rancher domestic users. If you have any Rancher-related experience to share or use questions, please scan the QR code at the end of the article to join the technical exchange group and communicate with all Rancher users.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。