在 air-gapped 环境中安装 Red Hat Developer Hub
摘要
第 1 章 air-gapped 环境 复制链接链接已复制到粘贴板!
air-gapped 环境(也称为 air-gapped 网络或隔离网络)通过物理隔离系统或网络来确保安全性。建立这个隔离,以防止 air-gapped 系统和外部源之间的未授权访问、数据传输或通信。
您可以在 air-gapped 环境中安装 Red Hat Developer Hub,以确保安全性并满足特定的法规要求。
在在受限网络中运行的 OpenShift Container Platform 集群上,无法使用公共资源。但是,部署 Red Hat Developer Hub Operator 并运行 Developer Hub 需要以下公共资源:
- Operator 镜像(bundle, operator, catalog)
- 操作对象镜像(RHDH、PostgreSQL)
要使这些资源可用,请将它们替换为 OpenShift Container Platform 集群可访问的镜像 registry 中的等效资源。
您可以使用一个帮助程序脚本来镜像所需的镜像,并提供必要的配置,以确保在安装 Red Hat Developer Hub Operator 并创建 Developer Hub 实例时将使用这些镜像。
此脚本需要一个目标镜像 registry,如果 OpenShift Container Platform 集群准备好在受限网络中操作,则应该已安装该 registry。但是,如果您准备集群以断开连接使用,您可以使用脚本在集群中部署镜像 registry,并将其用于镜像过程。
先决条件
-
您有一个活跃的 OpenShift CLI (
oc)会话,其中包含对 OpenShift Container Platform 集群的管理权限。请参阅 OpenShift CLI 入门。 -
您有一个活跃的
oc registry会话到registry.redhat.io红帽生态系统目录。请参阅 Red Hat Container Registry Authentication。 -
已安装
opmCLI 工具。请参阅安装 opm CLI。 - 已安装 jq 软件包。请参阅 下载 jq。
- podman 已安装。请参阅 Podman 安装说明。
- Skopeo 版本 1.14 或更高版本已安装。请参阅 安装 Skopeo。
- 如果您已经有集群的镜像 registry,则需要一个具有管理访问权限的活跃 Skopeo 会话。请参阅认证到 registry 并为断开连接的安装 mirror 镜像。
内部 OpenShift Container Platform 集群镜像 registry 不能用作目标镜像 registry。请参阅关于镜像 registry。
- 如果要创建自己的镜像 registry,请参阅为 Red Hat OpenShift 创建带有 mirror registry 的 mirror registry。
如果您还没有镜像 registry,您可以使用 helper 脚本为您创建一个,并需要以下额外先决条件:
- 已安装 cURL 软件包。对于 Red Hat Enterprise Linux,可以通过安装 curl 软件包来使用 curl 命令。要将 curl 用于其他平台,请查看 cURL 网站。
-
htpasswd命令可用。对于 Red Hat Enterprise Linux,可以通过安装httpd-tools软件包来使用htpasswd命令。
流程
下载并运行镜像脚本,以安装自定义 Operator 目录并镜像相关镜像:
prepare-restricted-environment.sh(source)。curl -sSLO https://raw.githubusercontent.com/redhat-developer/rhdh-operator/release-1.4/.rhdh/scripts/prepare-restricted-environment.sh # if you do not already have a target mirror registry # and want the script to create one for you # use the following example: bash prepare-restricted-environment.sh \ --prod_operator_index "registry.redhat.io/redhat/redhat-operator-index:v4.17" \ --prod_operator_package_name "rhdh" \ --prod_operator_bundle_name "rhdh-operator" \ --prod_operator_version "v1.4.3" # if you already have a target mirror registry # use the following example: bash prepare-restricted-environment.sh \ --prod_operator_index "registry.redhat.io/redhat/redhat-operator-index:v4.17" \ --prod_operator_package_name "rhdh" \ --prod_operator_bundle_name "rhdh-operator" \ --prod_operator_version "v1.4.3" \ --use_existing_mirror_registry "my_registry"注意该脚本可能需要几分钟才能完成,因为它将多个镜像复制到镜像 registry。
air-gapped 环境(也称为 air-gapped 网络或隔离网络)通过物理隔离系统或网络来确保安全性。建立这个隔离,以防止 air-gapped 系统和外部源之间的未授权访问、数据传输或通信。
您可以在 air-gapped 环境中安装 Red Hat Developer Hub,以确保安全性并满足特定的法规要求。
要在 air-gapped 环境中安装 Developer Hub,您必须可以访问 registry.redhat.io 和 air-gapped 环境的 registry。
先决条件
- 已安装 Red Hat OpenShift Container Platform 4.14 或更高版本。
-
您可以访问
registry.redhat.io。 - 您可以访问集群的 Red Hat OpenShift Container Platform 镜像 registry。有关公开镜像 registry 的更多信息,请参阅 Red Hat OpenShift Container Platform 文档中有关 公开 registry 的内容。
-
已在工作站上安装了 OpenShift CLI (
oc)。 -
您已在工作站上安装了
podman命令行工具。 - 在 Red Hat Developer Portal 中有一个帐户。
流程
运行以下命令,使用 OpenShift CLI (
oc)登录到 OpenShift Container Platform 帐户:oc login -u <user> -p <password> https://api.<hostname>:6443运行以下命令,使用
podman命令行工具登录到 OpenShift Container Platform 镜像 registry:podman login -u kubeadmin -p $(oc whoami -t) default-route-openshift-image-registry.<hostname>注意您可以运行以下命令来获取 OpenShift Container Platform 镜像 registry 的完整主机名,然后在命令中使用主机名登录:
REGISTRY_HOST=$(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')podman login -u kubeadmin -p $(oc whoami -t) $REGISTRY_HOST运行以下命令,登录到
podman中的registry.redhat.io:podman login registry.redhat.io有关 registry 身份验证的更多信息,请参阅 Red Hat Container Registry 身份验证。
运行以下命令,将 Developer Hub 和 PostgreSQL 镜像从 Red Hat Image registry 拉取到工作站:
podman pull registry.redhat.io/rhdh/rhdh-hub-rhel9:1.4podman pull registry.redhat.io/rhel9/postgresql-15:latest运行以下命令,将两个镜像推送到内部 OpenShift Container Platform 镜像 registry:
podman push --remove-signatures registry.redhat.io/rhdh/rhdh-hub-rhel9:1.4 default-route-openshift-image-registry.<hostname>/<project_name>/rhdh-hub-rhel9:1.4podman push --remove-signatures registry.redhat.io/rhel9/postgresql-15:latest default-route-openshift-image-registry.<hostname>/<project_name>/postgresql-15:latest有关将镜像直接推送到 OpenShift Container Platform 镜像 registry 的更多信息,请参阅如何直接将镜像推送到 OpenShift 4 registry 中。
重要如果发生 x509 错误,请验证您已在 系统上安装了用于 OpenShift Container Platform 路由的 CA 证书。
使用以下命令验证 OpenShift Container Platform 内部 registry 中是否存在这两个镜像:
oc get imagestream -n my-rhdh-project运行以下命令,为这两个镜像启用本地镜像查找:
oc set image-lookup postgresql-15oc set image-lookup rhdh-hub-rhel9进入 YAML 视图,并使用以下值为
backstage和postgresql更新image部分:Developer Hub 镜像的值示例
upstream: backstage: image: registry: "" repository: rhdh-hub-rhel9 tag: latestPostgreSQL 镜像的值示例
upstream: postgresql: image: registry: "" repository: postgresql-15 tag: latest- 使用 Helm Chart 安装 Red Hat Developer Hub。