Installing Infrastructure Automation in an air-gapped environment (offline) using a bastion host

If your cluster is not connected to the internet, you can deploy a production install of IBM Cloud Pak® for AIOps Infrastructure Automation on your cluster by using a bastion host.

In this scenario, your air-gapped (offline) environment has a target registry, and a Red Hat® OpenShift® Container Platform cluster on which Infrastructure Automation is to be installed. The bastion host has access to the internet and to the offline environment. Infrastructure Automation images are mirrored from the internet through the bastion server to the target registry in the offline environment. Infrastructure Automation can then be installed in the offline environment by using the target registry.

Before you begin

Important: The following procedure is based on an Red Hat OpenShift 4.18 environment and includes links for that version. If your environment uses a different supported version of Red Hat OpenShift, ensure that you follow the Red Hat OpenShift documentation for that version.

Procedure

From a high level, an air-gapped installation of Infrastructure Automation consists of five steps:

  1. Set up your mirroring environment
  2. Set environment variables and download CASE files
  3. Mirror images to your final location
  4. Configure storage
  5. Install Infrastructure Automation

1. Set up your mirroring environment

Before you install any IBM Cloud Pak® on an air-gapped environment, you must set up a host that can be connected to the internet to complete configuring your mirroring environment. To set up your mirroring environment, complete the following steps:

Prerequisites

Allow access to the following sites and ports:

Table 1. Sites and ports that must be accessible
Site Description
icr.io
cp.icr.io
dd0.icr.io
dd2.icr.io
dd4.icr.io
dd6.icr.io
Allow access to these hosts on port 443 to enable access to the IBM Cloud Container Registry, CASE OCI artifact, and IBM Cloud Pak® foundational services catalog source.
dd1-icr.ibm-zh.com
dd3-icr.ibm-zh.com
dd5-icr.ibm-zh.com
dd7-icr.ibm-zh.com
If you are located in China, also allow access to these hosts on port 443.
github.com Github houses CASE files, IBM Cloud Pak tools and scripts.
redhat.com Red Hat OpenShift registries that are required for Red Hat OpenShift, and for Red Hat OpenShift upgrades.

1.1 Install and configure Red Hat OpenShift

Infrastructure Automation requires Red Hat OpenShift to be installed and running on your target cluster. You must have administrative access to your Red Hat OpenShift cluster.

For more information about the supported versions of Red Hat OpenShift, see Supported Red Hat OpenShift Container Platform versions.

  1. Install Red Hat OpenShift by using the instructions in the Red Hat OpenShift documentation Opens in a new tab. Information about installing a cluster in a restricted network is given in Mirroring images for a disconnected installation Opens in a new tab.

  2. Install the Red Hat OpenShift command line interface (oc) on your cluster's boot node and run oc login. For more information, see the instructions in Getting started with the Red Hat OpenShift CLIOpens in a new tab.

  3. Optionally configure a custom certificate for Infrastructure Automation to use. You can use either of the following methods:

1.2 Set up a target registry

You must have a local Docker type production-grade registry available to store the Infrastructure Automation images in. The registry must meet the following requirements:

  • supports Docker Manifest V2, Schema 2.
  • supports multi-architecture images.
  • is accessible from the Red Hat OpenShift cluster nodes.
  • allows path separators in the image name.
  • you have the username and password for a user who can read from and write to the registry.

If you do not already have a suitable production-grade registry available, then you must install and configure one. For more information, see About the mirror registry Opens in a new tab in the Red Hat OpenShift documentation.

Important: Do not use the Red Hat OpenShift image registry as your target registry. The Red Hat OpenShift registry does not support multi-architecture images or path separators in the image name.

1.3 Prepare a host

You must prepare a bastion host that can connect to the internet and to the air-gapped network with access to the Red Hat® OpenShift® Container Platform cluster and the local, intranet Docker type registry. Your host must be on a Linux® x86_64 or Mac platform with any operating system that the IBM Cloud Pak® CLI and the Red Hat® OpenShift® Container Platform CLI support. If you are on a Windows platform, you must run the actions in a Linux® x86_64 VM or from a Windows Subsystem for Linux (WSL) terminal.

Your host must have 62 GB storage to hold all of the software that is to be transferred to the local, intranet Docker type registry.

The following table explains the software requirements for installing Infrastructure Automation in an air-gapped environment:

Table 2. Software requirements and purpose
Software Purpose
OpenSSL Validating certificates when you run the air-gapped install scripts
Podman Container management
Apache httpd-tools Creating an account when you run the air-gapped install scripts
Red Hat® OpenShift® Container Platform CLI (oc) Red Hat OpenShift Container Platform administration
IBM Catalog Management Plug-in for IBM Cloud Pak Running CASE commands

Complete the following steps on your host:

  1. Install OpenSSL version 1.11.1 or higher.

  2. Install Podman. For more information, see Podman Installation Instructions Opens in a new tab.

    Note: Docker is not shipped or supported by Red Hat for Red Hat Enterprise Linux (RHEL) 8 and (RHEL) 9 systems. The podman container engine replaced docker as the preferred, maintained, and supported container runtime of choice for Red Hat Enterprise Linux 8 and 9 systems. For more information, see the Red Hat documentation Running containers without Docker Opens in a new tab.

  3. Install httpd-tools.

    yum install httpd-tools
    
  4. Install the oc Red Hat® OpenShift® Container Platform CLI tool.

    oc is required for Red Hat OpenShift management. For more information, see Getting started with the OpenShift CLIOpens in a new tab in the Red Hat OpenShift documentation.

1.4 Install the IBM Catalog Management Plug-in for IBM Cloud Pak®

The IBM Catalog Management Plug-in for IBM Cloud Pak (ibm-pak-plugin) is used for the deployment of IBM Cloud Paks® in a disconnected environment. It simplifies the process for discovering required IBM product images and uses standard tools for registry and cluster access. The ibm-pak-plugin also extends the Red Hat OpenShift CLI (oc) capability to streamline the process of delivering installation images to the IBM Cloud Pak in an air-gapped environment.

  1. Download and install the most recent version of the ibm-pak-plugin for your host operating system from github.com/IBMOpens in a new tab.

  2. Run the following command to extract the files.

    tar -xf oc-ibm_pak-linux-amd64.tar.gz
    
  3. Run the following command to move the file to the /usr/local/bin directory.

    mv oc-ibm_pak-linux-amd64 /usr/local/bin/oc-ibm_pak
    

    Note: If you are installing as a non-root user, you must use sudo.

  4. Confirm that the ibm-pak-plugin is installed by running the following command.

    oc ibm-pak --help
    

    Expected result: The ibm-pak-plugin usage is displayed.

1.5 Download documentation and scripts for offline access

Download the following documents and scripts that you will need to be able to access offline during your Infrastructure Automation installation or uninstallation, and copy them to your air-gapped environment.

Cloud Pak for AIOps 4.9.0 documentation

Download the Cloud Pak for AIOps 4.9.0 documentation (this documentation) so that you can access it offline. You can download a PDF of the Cloud Pak for AIOps Infrastructure Automation documentation from PDF documentation.

Red Hat OpenShift Container Platform documentation

The Red Hat OpenShift Container Platform documentation can be downloaded for offline access from Red Hat Opens in a new tab.

IBM Cloud Paks® documentation

Download the IBM Cloud Paks® documentation so that you can access it offline. You can download a PDF of the documentation from PDF documentation.

2. Set environment variables and download CASE files

Before mirroring your images, set environment variables on your mirroring device, and connect to the internet so that you can download the corresponding CASE files. To finish preparing your host, complete the following steps.

Note: Save a copy of your environment variable values to a text editor. You can use that file as a reference to cut and paste from when completing your air-gapped installation tasks.

  1. Create the following environment variables with the installer image name and the image inventory on your host.

    export IA_CASE_NAME=ibm-ia-installer
    export IA_CASE_VERSION=1.13.0
    export IA_CASE_ARCHIVE=$IA_CASE_NAME-$IA_CASE_VERSION.tgz
    export IA_CASE_INVENTORY_SETUP=ibmInfrastructureAutomationOperatorSetup
    export IA_CASE_REPO_PATH=https://github.com/IBM/cloud-pak/raw/master/repo/case
    export TARGET_REGISTRY_HOST=<IP_or_FQDN_of_local_registry>
    export TARGET_REGISTRY_PORT=<port_number_of_local_registry>
    export TARGET_REGISTRY=$TARGET_REGISTRY_HOST:$TARGET_REGISTRY_PORT
    export TARGET_REGISTRY_USER=<username>
    export TARGET_REGISTRY_PASSWORD=<password>
    

    The target registry is the registry where the Infrastructure Automation images will be mirrored to, and accessed from by the Red Hat OpenShift cluster, as setup in 1.1 Set up a target registry.

    If your bastion host must connect to the internet through a proxy, then also set the following environment variables.

    export https_proxy=http://proxy-server-hostname:port
    export http_proxy=http://proxy-server-hostname:port
    
  2. Connect your host to the internet and disconnect it from the local air-gapped network.

  3. Download the Infrastructure Automation installer and image inventory to your host.

    oc ibm-pak get $IA_CASE_NAME --version $IA_CASE_VERSION
    

    The CASE is downloaded to ~/.ibm-pak/data/cases/$IA_CASE_NAME/$IA_CASE_VERSION. The logs files are available at ~/.ibm-pak/logs/oc-ibm_pak.log.

    Note: If you do not specify the CASE version, then the latest CASE is downloaded. The root directory that is used by ibm-pak-plugin is ~/.ibm-pak. If required, the root directory can be configured by setting the IBMPAK_HOME environment variable.

  4. Verify that the images are downloaded by running ls against your offline directory.

    ls ~/.ibm-pak/data/cases/${IA_CASE_NAME}/${IA_CASE_VERSION}
    

Your host is now configured and you are ready to mirror your images.

3. Mirror images to your final location

The process of mirroring images takes the image from the internet to your host, then effectively copies that image on to your air-gapped environment. After you mirror your images, you can configure your cluster and complete an air-gapped installation.

Notes:

  • If you want to install subsequent updates to your air-gapped environment, you must do a CASE save to get the image list when performing those updates.
  • For details on ensuring you do not introduce changes to multiple environments, see Setting up a repeatable air-gap process.
  • For your mirror registry certs, include a SAN entry. In addition, configure your cluster with the certs or mark the registry as insecure. For more information about how to complete the configuration, see the Red Hat OpenShift documentation Setting up additional trusted certificate authorities for builds Opens in a new tab.

Complete the following steps to mirror the Infrastructure Automation, IBM Cloud Pak foundational services Cert Manager, and IBM Cloud Pak foundational services License Service images from the internet to the target registry in the air-gapped environment.

3.1. Generate mirror manifests

Run the following command to generate mirror manifests to be used when mirroring the images to the target registry.

oc ibm-pak generate mirror-manifests $IA_CASE_NAME $TARGET_REGISTRY --version $IA_CASE_VERSION

A new directory named ~/.ibm-pak/mirror is created when you issue the oc ibm-pak generate mirror-manifests command. The files images-mapping.txt and image-content-source-policy.yaml are generated at ~/.ibm-pak/data/mirror/$IA_CASE_NAME/$IA_CASE_VERSION.

3.2. Authenticate with the registries

Log in to the registries to generate an authentication file containing the registry credentials, and then create an environment variable that has the location of the authentication file. This file is used later to enable the oc image mirror command to pull the images from the IBM Entitled Registry, and push them to the target registry.

  1. Get the authentication credentials for the IBM Entitled Registry.

    1. To obtain the entitlement key that is assigned to your IBMid, log in to MyIBM Container Software Library Opens in a new tab with the IBMid and password details that are associated with the entitled software.

    2. In the Entitlement keys section, select Copy key to copy the entitlement key.

  2. Run the following command to create an environment variable containing your entitlement key.

    export ENTITLED_REGISTRY_PASSWORD=<key>
    

    Where <key> is the entitlement key that you copied in the previous step.

  3. Store the authentication credentials for the IBM Entitled Registry and the target registry.

    Run the following commands:

    podman login cp.icr.io -u cp -p $ENTITLED_REGISTRY_PASSWORD
    podman login $TARGET_REGISTRY -u $TARGET_REGISTRY_USER -p $TARGET_REGISTRY_PASSWORD
    export REGISTRY_AUTH_FILE=${XDG_RUNTIME_DIR}/containers/auth.json
    unset ENTITLED_REGISTRY_PASSWORD
    

    Note: The authentication file is usually at ${XDG_RUNTIME_DIR}/containers/auth.json. For more information, see the Options section in the Podman documentationOpens in a new tab.

3.3. Mirror the images

Complete these steps on your host that is connected to both the local registry and the Red Hat OpenShift cluster.

Mirror images to the target registry.

nohup oc image mirror \
 -f ~/.ibm-pak/data/mirror/$IA_CASE_NAME/$IA_CASE_VERSION/images-mapping.txt \
 -a $REGISTRY_AUTH_FILE \
 --filter-by-os '.*' \
 --insecure \
 --skip-multiple-scopes \
 --max-per-registry=1 \
 --continue-on-error=true > my-mirror-progress.txt 2>&1 &

The UNIX command nohup is used to ensure that the mirroring process continues even if there is a loss of network connection, and redirection of output to a file provides improved monitoring and error visibilty.

Run the following command if you want to see the progress of the mirroring:

tail -f my-mirror-progress.txt

Note: If an error occurs during mirroring, the mirror command can be re-run.

3.4 Configure the cluster

  1. Log in to your OpenShift cluster.

    You can identify your specific oc login command by clicking the user menu in the upper left corner of the Red Hat OpenShift console, and then clicking Copy Login Command.

    Example:

    oc login <server> -u <cluster username> -p <cluster pass>
    
  2. Update the global image pull secret for your Red Hat OpenShift cluster.

    Follow the steps in the Red Hat OpenShift documentation topic Updating the global cluster pull secretOpens in a new tab.

    These steps enable your cluster to have authentication credentials in place to pull images from your TARGET_REGISTRY as specified in the image-content-source-policy.yaml, which you will apply to your cluster in the next step.

  3. Create the ImageContentSourcePolicy.

    Run the following command to create the ImageContentSourcePolicy.

    oc apply -f  ~/.ibm-pak/data/mirror/$IA_CASE_NAME/$IA_CASE_VERSION/image-content-source-policy.yaml
    
  4. Verify that the ImageContentSourcePolicy resource is created.

    oc get imageContentSourcePolicy
    
  5. Verify your cluster node status.

    oc get MachineConfigPool -w
    

    Important: After the ImageContentsourcePolicy and global image pull secret are applied, the configuration of your nodes will be updated sequentially. Wait until all of the MachineConfigPools are updated before you proceed to the next step.

  6. (Optional) If you use an insecure registry, you must add the target registry to the cluster's insecureRegistries list.

    oc patch image.config.openshift.io/cluster --type=merge \
    -p '{"spec":{"registrySources":{"insecureRegistries":["'${TARGET_REGISTRY}'"]}}}'
    

4. Configure storage

The storage configuration must satisfy your sizing requirements. Two storage classes are needed for installing Infrastructure Automation. For more information, see Storage.

5. Install Infrastructure Automation

Now that your images are mirrored to your air-gapped environment, you can deploy Infrastructure Automation to that environment. When you mirrored your environment, you created a parallel offline version of everything that you needed to install an operator into Red Hat® OpenShift® Container Platform. To install Infrastructure Automation, complete the following steps.

5.1 Create a custom project (namespace)

Create a project (namespace) called cp4aiops for your Infrastructure Automation deployment, by running the following command:

oc create namespace cp4aiops

5.2 Create the catalog source

  1. Run the following command:

    oc apply -f ~/.ibm-pak/data/mirror/$IA_CASE_NAME/$IA_CASE_VERSION/catalog-sources.yaml
    
  2. Run the following command to verify that you have all the required catalog sources created.

    oc get pods -n openshift-marketplace
    oc get catalogsource -n openshift-marketplace
    

    The output must include:

    cam-install-operator-controller-manager-catalog
    cloud-native-postgresql-catalog
    ibm-cert-manager-catalog
    ibm-infra-management-install-operator-catalog
    ibm-infrastructure-automation-operator-catalog
    ibm-licensing-catalog
    opencloud-operators
    

5.3 Install Cert Manager

Skip this step if you already have a certificate manager installed on the Red Hat OpenShift cluster that you are installing Infrastructure Automation on. If you do not have a certificate manager then you must install one. The IBM Cloud Pak® foundational services Cert Manager is recommended, and can be installed with the following steps.

Note: If you are installing Infrastructure Automation and IBM Cloud Pak for AIOps on the same Red Hat OpenShift cluster, then you already installed the IBM Cloud Pak foundational services Cert Manager as part of the IBM Cloud Pak for AIOps installation process. If you are installing Infrastructure Automation and IBM Cloud Pak for AIOps on different clusters, then you must ensure that IBM Cloud Pak foundational services Cert Manager is installed on each cluster.

For more information about IBM Cloud Pak® foundational services Cert Manager hardware requirements, see IBM Certificate Manager (cert-manager) hardware requirements Opens in a new tab in the IBM Cloud Pak foundational services documentation.

  1. Run the following command to create the resource definitions that you need:

    cat << EOF | oc apply -f -
    apiVersion: v1
    kind: Namespace
    metadata:
      name: ibm-cert-manager
    ---
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: ibm-cert-manager-operator-group
      namespace: ibm-cert-manager
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: ibm-cert-manager-operator
      namespace: ibm-cert-manager
    spec:
      channel: v4.2
      installPlanApproval: Automatic
      name: ibm-cert-manager-operator
      source: ibm-cert-manager-catalog
      sourceNamespace: openshift-marketplace
    EOF
    
  2. Run the following command to ensure that the IBM Cloud Pak foundational services Cert Manager pods have a STATUS of Running before proceeding to the next step.

    oc -n ibm-cert-manager get pods
    

    Example output for a successful IBM Cloud Pak foundational services Cert Manager installation:

    NAME                                        READY   STATUS    RESTARTS   AGE
    cert-manager-cainjector-674854c49d-vstq4    1/1     Running   0          8d
    cert-manager-controller-646d4bd6fd-zwmqm    1/1     Running   0          8d
    cert-manager-webhook-8598787c8-s4lkt        1/1     Running   0          8d
    ibm-cert-manager-operator-c96957695-dkxnm   1/1     Running   0          8d
    

5.4 Install the License Service

Skip this step if the IBM Cloud Pak foundational services License Service is already installed on the Red Hat OpenShift cluster that you are installing Infrastructure Automation on.

Note: If you are installing Infrastructure Automation and IBM Cloud Pak for AIOps on the same Red Hat OpenShift cluster, then you already installed IBM Cloud Pak foundational services License Service as part of the IBM Cloud Pak for AIOps installation process. If you are installing Infrastructure Automation and IBM Cloud Pak for AIOps on different clusters, then you must ensure that IBM Cloud Pak foundational services License Service is installed on each cluster.

Infrastructure Automation requires the installation of the IBM Cloud Pak foundational services License Service. You must install the IBM Cloud Pak foundational services License Service on the Red Hat OpenShift cluster that you are installing Infrastructure Automation on.

  1. Run the following command to create the resource definitions that you need:

    cat << EOF | oc apply -f -
    apiVersion: v1
    kind: Namespace
    metadata:
      name: ibm-licensing
    ---
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: ibm-licensing-operator-group
      namespace: ibm-licensing
    spec:
      targetNamespaces:
      - ibm-licensing
    ---
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: ibm-licensing-operator-app
      namespace: ibm-licensing
    spec:
      channel: v4.2
      installPlanApproval: Automatic
      name: ibm-licensing-operator-app
      source: ibm-licensing-catalog
      sourceNamespace: openshift-marketplace
    EOF
    
  2. Run the following command to ensure that the IBM Cloud Pak foundational services License Server pods have a STATUS of Running before proceeding to the next step.

    oc -n ibm-licensing get pods
    

    Example output for a successful IBM Cloud Pak foundational services License Service installation:

    NAME                                              READY   STATUS    RESTARTS   AGE
    ibm-licensing-operator-db4cd746c-xzmlf            1/1     Running   0          8d
    ibm-licensing-service-instance-596b99588f-76cc5   1/1     Running   0          8d
    

For more information about the IBM Cloud Pak® foundational services License Service, see License Service Opens in a new tab in the IBM Cloud Pak foundational services documentation.

5.5 Install Infrastructure Automation

If you want to install Infrastructure Automation with Cloud Pak for AIOps, follow step 5 Install theInfrastructure Automation operator and onwards in Online installation of Infrastructure Automation for use with IBM Cloud Pak for AIOps (CLI).

If you want to install stand-alone Infrastructure Automation, follow step 8 and onwards Online installation of Infrastructure Automation (CLI).