Air-Gapped Environment
In the air-gapped environment, you need to manually manage container images for EGS. You can use the following scripts to extract and push container images for air-gapped deployments:
-
airgap-image-pull.sh: Extracts all container images from Helm charts for
kubeslice-egs-helm-ent-prod charts. It reads chart information from a configuration file and generates a comprehensive list of all container images used in the specified Helm charts. -
airgap-image-push.sh: Pushes container images to a target repository. It reads a list of images and performs pull, tag, and push operations for AirGap deployments.
Prerequisites
Before you begin, ensure you have the following prerequisites:
- Helm installed on your local machine with version
v3.0.0or higher. - Git installed on your local machine.
- yq installed on your local machine with version
v4.0.0or higher. - bash shell to run the scripts with version
v4.0.0or higher. - sed command-line utility installed on your local machine.
- Access to the target container image repository where you want to push the images.
- Network access to pull images from public registries (for the initial extraction step).
Clone the Repository
To copy the scripts, clone the EGS installation repository using the following command:
git clone https://github.com/kubeslice-ent/egs-installation.git
Navigate to the egs-installation/airgap-image-push directory:
cd egs-installation/airgap-image-push
Input File for Helm Charts
The airgap-image-pull.sh and airgap-image-push.sh scripts require an input file that specifies the Helm charts to process.
The airgap-image-pull.sh script reads chart information from a text file named helm-chart-info.txt. This file must be specified
using the HELM_CHART_INFO environment variable.
Field Descriptions
The helm-chart-info.txt file should contain the following fields in a space-separated format:
- repo-url: The URL of the Helm chart repository. The value must be
https://kubeslice.aveshalabs.io/repository. - repo-name: The name of the Helm chart repository. The value must be
kubeslice-egs-helm-ent-prod. - chart-name: The name of the Helm chart. It must be one of the following charts:
kubeslice-controller-egskubeslice-worker-egskubeslice-ui-egs
- chart-version: The version of the Helm chart. You can specify a specific version (for example,
1.15.4) or use*to indicate the latest version available in the repository.
Example Input Files
The following is an example of helm-chart-info.txt with specific Versions:
*****************<repo-url>*************** ******<repo-name>****** ****<chart-name>**** ****<chart-version>****
https://kubeslice.aveshalabs.io/repository kubeslice-egs-helm-ent-prod kubeslice-controller-egs 1.15.4
https://kubeslice.aveshalabs.io/repository kubeslice-egs-helm-ent-prod kubeslice-worker-egs 1.15.4
https://kubeslice.aveshalabs.io/repository kubeslice-egs-helm-ent-prod kubeslice-ui-egs 1.15.4
You can specify * for the <chart-version> field to indicate the latest version available in the repository.
The helm-chart-info.txt is an example file to illustrate the required format for the input file used by the scripts.
The file is available in the airgap-image-push/ directory for reference.
When running the scripts from within the airgap-image-push/ directory, use:
export HELM_CHART_INFO="helm-chart-info.txt"
The file name helm-chart-info.txt is a convention, but you can use any filename.
Ensure you set the HELM_CHART_INFO environment variable to point to your input file.
Extract Container Images
The airgap-image-pull.sh script reads chart information from file named helm-chart-info.txt. This file should be
specified using the HELM_CHART_INFO environment variable.
To extract container images from Helm charts, use the airgap-image-pull.sh script with the following command:
export HELM_CHART_INFO="helm-chart-info.txt"
bash airgap-image-pull.sh
The output is a file named helm-chart-images.txt that contains a list of all unique container images used in the specified
Helm charts.
Push Container Images to Target Repository
The airgap-image-push.sh script reads a list of images from a file named helm-chart-info.txt. This file should be
specified using the HELM_CHART_INFO environment variable.
Supported Registry Formats
| Registry Type | REPO Format | Tagged Image Format |
|---|---|---|
| Docker Hub | docker.io/username | username/image:tag |
| Private Registry (Nexus) | registry.example.com | registry.example.com/path/image:tag |
Prerequisites
Before pushing images to the target repository, ensure you have the following prerequisites:
-
Docker installed on your local machine.
-
Access credentials for the target container image repository. you may need to log in to the repository using Docker CLI.
-
Docker login command.
docker login -u <username> -
Privately hosted registries may require additional parameters such as
--passwordand--email.docker login -u <username> --password <password> --email <email> <registry-url>
Authentication is required to push images to private registries.
-
Push Images
To push container images to a target repository, use the airgap-image-push.sh script with the following commands:
-
Set the
HELM_CHART_INFOenvironment variable to point to thehelm-chart-images.txtfile generated in the previous step. -
Set the REPO variable for the target repository where you want to push the images.
-
Use the following helper command to copy the images from the
helm-chart-images.txtfile to a temporary file/tmp/images.txtin the required format:cat helm-chart-images.txt | sed 's/^/"/' | sed 's/$/"/' > /tmp/images.txt -
Manually copy the images from the
/tmp/images.txtfile and update the IMAGES array in theairgap-image-push.shscript. -
Run the
airgap-image-push.shscript using the following command:bash airgap-image-push.sh