4.2. 在使用 Helm Chart 的部分断开连接的环境中在受支持的 Kubernetes 平台上安装 Red Hat Developer Hub
在部分断开连接的环境中,集群无法访问外部 registry,如 registry.redhat.io,但它可以访问内部镜像 registry。此方法需要直接从集群直接访问内部镜像 registry。
先决条件
您已设置了工作站。
- 已安装 Skopeo 1.17 或更高版本
- 已安装 Yq 4.4 或更高版本
- 已安装 Helm 3.13 或更高版本
- 您有一个针对 registry.redhat.io 的活跃 Skopeo 会话
-
您有一个针对目标镜像 registry 的活跃 Skopeo 会话,如
registry.internal.example.com
-
您可以访问配置了
kubectl
的 Kubernetes 集群
流程
在终端中,运行以下命令来下载并提取 Helm Chart:
helm repo add _<helm_chart_repo_name>_ https://charts.openshift.io/ helm repo update helm pull _<helm_chart_repo_name>_/redhat-developer-hub --version _<rhdh_version>_ helm show values _<helm_chart_repo_name>_/redhat-developer-hub --version _<rhdh_version>_ > values.default.yaml
helm repo add _<helm_chart_repo_name>_ https://charts.openshift.io/ helm repo update helm pull _<helm_chart_repo_name>_/redhat-developer-hub --version _<rhdh_version>_ helm show values _<helm_chart_repo_name>_/redhat-developer-hub --version _<rhdh_version>_ > values.default.yaml
Copy to Clipboard Copied! 其中
- <helm_chart_repo_name>
-
指定 Helm Chart 仓库的名称,如
openshift-helm-charts
。 - <rhdh_version>
-
指定您要使用的 Red Hat Developer Hub 版本,如
1.6.2
。
运行以下命令,使用
yq
提取镜像摘要:RHDH_IMAGE=$(yq '.upstream.backstage.image | .registry + "/" + .repository' values.default.yaml) RHDH_DIGEST=$(yq '.upstream.backstage.image.tag' values.default.yaml) PG_IMAGE=$(yq '.upstream.postgresql.image | .registry + "/" + .repository' values.default.yaml) PG_DIGEST=$(yq '.upstream.postgresql.image.tag' values.default.yaml)
RHDH_IMAGE=$(yq '.upstream.backstage.image | .registry + "/" + .repository' values.default.yaml) RHDH_DIGEST=$(yq '.upstream.backstage.image.tag' values.default.yaml) PG_IMAGE=$(yq '.upstream.postgresql.image | .registry + "/" + .repository' values.default.yaml) PG_DIGEST=$(yq '.upstream.postgresql.image.tag' values.default.yaml)
Copy to Clipboard Copied! 输入以下命令将镜像镜像到内部镜像 registry:
skopeo login registry.redhat.io skopeo login _<mirror_registry_name>_ skopeo copy --remove-signatures \ docker://${PG_IMAGE}@${PG_DIGEST} \ docker://_<mirror_registry_name>_/_<postgresql_repo_name>_:${PG_DIGEST} skopeo copy --remove-signatures \ docker://${RHDH_IMAGE}@${RHDH_DIGEST} \ docker://_<mirror_registry_name>_/_<rhdh_repo_name>_${RHDH_DIGEST}
skopeo login registry.redhat.io skopeo login _<mirror_registry_name>_ skopeo copy --remove-signatures \ docker://${PG_IMAGE}@${PG_DIGEST} \ docker://_<mirror_registry_name>_/_<postgresql_repo_name>_:${PG_DIGEST} skopeo copy --remove-signatures \ docker://${RHDH_IMAGE}@${RHDH_DIGEST} \ docker://_<mirror_registry_name>_/_<rhdh_repo_name>_${RHDH_DIGEST}
Copy to Clipboard Copied! 其中
- <mirror_registry_name>
-
指定内部镜像 registry 的名称,如
registry.internal.example.com
。 - <postgresql_repo_name>
-
指定 PostgreSQL 存储库的名称,如
rhdh/postgresql-15
。 - <rhdh_repo_name>
-
指定 Red Hat Developer Hub 存储库的名称,如
rhdh/rhdh-hub-rhel9
。
为您要使用的 Kubernetes 平台创建一个
values.yaml
文件,并为该文件添加以下镜像引用以反映本地用途:upstream: backstage: image: registry: "_<mirror_registry_name>_" repository: _<rhdh_repo_name>_ tag: "${RHDH_DIGEST}" postgresql: image: registry: "_<mirror_registry_name>_" repository: _<postgresql_repo_name>_ tag: "${PG_DIGEST}"
upstream: backstage: image: registry: "_<mirror_registry_name>_" repository: _<rhdh_repo_name>_ tag: "${RHDH_DIGEST}" postgresql: image: registry: "_<mirror_registry_name>_" repository: _<postgresql_repo_name>_ tag: "${PG_DIGEST}"
Copy to Clipboard Copied! 对于 AKS,请使用以下
values.yaml
文件模板:global: host: <app_address> route: enabled: false upstream: ingress: enabled: true className: webapprouting.kubernetes.azure.com host: backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 3000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true
global: host: <app_address> route: enabled: false upstream: ingress: enabled: true className: webapprouting.kubernetes.azure.com host: backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 3000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true
Copy to Clipboard Copied! 对于 EKS,请使用以下
values.yaml
文件模板:global: # TODO: Set your application domain name. host: <your Developer Hub domain name> route: enabled: false upstream: service: # NodePort is required for the ALB to route to the Service type: NodePort ingress: enabled: true annotations: kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing # TODO: Using an ALB HTTPS Listener requires a certificate for your own domain. Fill in the ARN of your certificate, e.g.: alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:xxx:xxxx:certificate/xxxxxx alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' alb.ingress.kubernetes.io/ssl-redirect: '443' # TODO: Set your application domain name. external-dns.alpha.kubernetes.io/hostname: <your rhdh domain name> backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: # you can assign any random value as fsGroup fsGroup: 2000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true # you can assign any random value as fsGroup fsGroup: 3000 volumePermissions: enabled: true
global: # TODO: Set your application domain name. host: <your Developer Hub domain name> route: enabled: false upstream: service: # NodePort is required for the ALB to route to the Service type: NodePort ingress: enabled: true annotations: kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/scheme: internet-facing # TODO: Using an ALB HTTPS Listener requires a certificate for your own domain. Fill in the ARN of your certificate, e.g.: alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:xxx:xxxx:certificate/xxxxxx alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' alb.ingress.kubernetes.io/ssl-redirect: '443' # TODO: Set your application domain name. external-dns.alpha.kubernetes.io/hostname: <your rhdh domain name> backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: # you can assign any random value as fsGroup fsGroup: 2000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true # you can assign any random value as fsGroup fsGroup: 3000 volumePermissions: enabled: true
Copy to Clipboard Copied! 对于 GKE,请使用以下
values.yaml
文件模板:global: host: <rhdh_domain_name> route: enabled: false upstream: service: type: NodePort ingress: enabled: true annotations: kubernetes.io/ingress.class: gce kubernetes.io/ingress.global-static-ip-name: <ADDRESS_NAME> networking.gke.io/managed-certificates: <rhdh_certificate_name> networking.gke.io/v1beta1.FrontendConfig: <ingress_security_config> className: gce backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 2000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true
global: host: <rhdh_domain_name> route: enabled: false upstream: service: type: NodePort ingress: enabled: true annotations: kubernetes.io/ingress.class: gce kubernetes.io/ingress.global-static-ip-name: <ADDRESS_NAME> networking.gke.io/managed-certificates: <rhdh_certificate_name> networking.gke.io/v1beta1.FrontendConfig: <ingress_security_config> className: gce backstage: image: pullSecrets: - rhdh-pull-secret podSecurityContext: fsGroup: 2000 postgresql: image: pullSecrets: - rhdh-pull-secret primary: podSecurityContext: enabled: true fsGroup: 3000 volumePermissions: enabled: true
Copy to Clipboard Copied!
运行以下命令,在当前命名空间中安装 Helm Chart:
helm install rhdh ./_<helm_chart_archive_file_name>_ -f values.yaml
helm install rhdh ./_<helm_chart_archive_file_name>_ -f values.yaml
Copy to Clipboard Copied! 其中
- <helm_chart_archive_file_name>
-
指定 Helm Chart 归档文件的名称,如
redhat-developer-hub-1.6.2.tgz
。