kubespray/contrib/offline
anders-elastisys 8fa5ae1865
bin: improve manage-offline-container-images script (#10857)
Fixes bug for retrieving images with tags containing image digests.
Script now gets images from jobs and cronjobs as well.
New env variable DESTINATION_REGISTRY to push to another registry
instead of local registry.
New env variable IMAGES_FROM_FILE to pull images listed in a file
instead of getting images from a running k8s environment.
New env variable REGISTRY_PORT to override port (default is 5000).
2024-02-17 19:34:29 -08:00
..
README.md bin: improve manage-offline-container-images script (#10857) 2024-02-17 19:34:29 -08:00
docker-daemon.json Add manage-offline-container-images.sh (#7024) 2021-01-06 08:05:52 -08:00
generate_list.sh Fix the path of download.yml (#10711) 2023-12-12 13:47:27 +01:00
generate_list.yml Resolve ansible-lint name errors (#10253) 2023-07-26 07:36:22 -07:00
manage-offline-container-images.sh bin: improve manage-offline-container-images script (#10857) 2024-02-17 19:34:29 -08:00
manage-offline-files.sh Fix file loss during download (#10779) 2024-01-22 05:56:08 +01:00
nginx.conf add manage offline files script (#8956) 2022-06-21 03:49:43 -07:00
registries.conf Add manage-offline-container-images.sh (#7024) 2021-01-06 08:05:52 -08:00

README.md

Offline deployment

manage-offline-container-images.sh

Container image collecting script for offline deployment

This script has two features: (1) Get container images from an environment which is deployed online, or set IMAGES_FROM_FILE environment variable to get images from a file (e.g. temp/images.list after running the ./generate_list.sh script). (2) Deploy local container registry and register the container images to the registry.

Step(1) should be done online site as a preparation, then we bring the gotten images to the target offline environment. if images are from a private registry, you need to set PRIVATE_REGISTRY environment variable. Then we will run step(2) for registering the images to local registry, or to an existing registry set by the DESTINATION_REGISTRY environment variable. By default, the local registry will run on port 5000. This can be changed with the REGISTRY_PORT environment variable

Step(1) can be operated with:

manage-offline-container-images.sh   create

Step(2) can be operated with:

manage-offline-container-images.sh   register

generate_list.sh

This script generates the list of downloaded files and the list of container images by roles/kubespray-defaults/defaults/main/download.yml file.

Run this script will execute generate_list.yml playbook in kubespray root directory and generate four files, all downloaded files url in files.list, all container images in images.list, jinja2 templates in *.template.

./generate_list.sh
tree temp
temp
├── files.list
├── files.list.template
├── images.list
└── images.list.template
0 directories, 5 files

In some cases you may want to update some component version, you can declare version variables in ansible inventory file or group_vars, then run ./generate_list.sh -i [inventory_file] to update file.list and images.list.

manage-offline-files.sh

This script will download all files according to temp/files.list and run nginx container to provide offline file download.

Step(1) generate files.list

./generate_list.sh

Step(2) download files and run nginx container

./manage-offline-files.sh

when nginx container is running, it can be accessed through http://127.0.0.1:8080/.