在 Microsoft Azure Kubernetes Service 上安装 Red Hat Developer Hub


Red Hat Developer Hub 1.7

使用 Operator 或 Helm chart 在 Microsoft Azure Kubernetes Service (AKS)上运行 Red Hat Developer Hub

Red Hat Customer Content Services

摘要

Red Hat Developer Hub (RHDH)是用于构建开发人员门户网站的企业级平台。管理用户可以配置角色、权限和其他设置,以使其他授权用户能够使用 Operator 或 Helm Chart 在 Microsoft Azure Kubernetes Service (AKS)上部署 RHDH 实例。

前言

您可以使用以下方法之一在 Microsoft Azure Kubernetes Service (AKS)上安装 Red Hat Developer Hub:

  • Red Hat Developer Hub Operator
  • Red Hat Developer Hub Helm chart

第 1 章 使用 Operator 在 AKS 上部署 Developer Hub

您可以使用 Red Hat Developer Hub Operator 在 AKS 上部署 Developer Hub。

流程

  1. 使用您的红帽凭证创建一个名为 rhdh-pull-secretImagePull Secret,以访问受保护的 registry.redhat.io 中的镜像,如下例所示:

    kubectl -n <your_namespace> create secret docker-registry rhdh-pull-secret \
        --docker-server=registry.redhat.io \
        --docker-username=<redhat_user_name> \
        --docker-password=<redhat_password> \
        --docker-email=<email>
    Copy to Clipboard Toggle word wrap
  2. 创建名为 rhdh-ingress.yaml 的 Ingress 清单文件,指定 Developer Hub 服务名称,如下所示:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: rhdh-ingress
      namespace: my-rhdh-project
    spec:
      ingressClassName: webapprouting.kubernetes.azure.com
      rules:
        - http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: backstage-<your-CR-name>
                    port:
                      name: http-backend
    Copy to Clipboard Toggle word wrap
  3. 要部署创建的 Ingress,请运行以下命令:

    kubectl -n <your_namespace> apply -f rhdh-ingress.yaml
    Copy to Clipboard Toggle word wrap
  4. 使用以下示例,创建一个包含 app-config.yaml Developer Hub 配置文件的 my-rhdh-app-config 配置映射:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: my-rhdh-app-config
    data:
      "app-config.yaml": |
        app:
          title: Red Hat Developer Hub
          baseUrl: https://<app_address>
        backend:
          auth:
            externalAccess:
                - type: legacy
                  options:
                    subject: legacy-default-config
                    secret: "${BACKEND_SECRET}"
          baseUrl: https://<app_address>
          cors:
            origin: https://<app_address>
    Copy to Clipboard Toggle word wrap
  5. 创建一个 & lt;my_product_secrets > secret,并添加名为 BACKEND_SECRET 的键,并带有 Base64 编码的字符串 值,如下例所示:

    apiVersion: v1
    kind: Secret
    metadata:
      name: <my_product_secrets> 
    1
    
    stringData:
      BACKEND_SECRET: "xxx"
    Copy to Clipboard Toggle word wrap
    1
    <my_product_secrets > 是您首选的 Developer Hub secret 名称,其中 < my_product_secrets > 指定 Developer Hub 中 secret 配置的标识符。
  6. 创建名为 < your-rhdh-cr>Backstage 自定义资源(CR)清单文件,并包括之前创建的 rhdh-pull-secret,如下所示:

    apiVersion: rhdh.redhat.com/v1alpha3
    kind: Backstage
    metadata:
      name: <your-rhdh-cr>
    spec:
      application:
        imagePullSecrets:
          - rhdh-pull-secret
        appConfig:
          configMaps:
            - name: my-rhdh-app-config
        extraEnvs:
          secrets:
            - name: <my_product_secrets> 
    1
    Copy to Clipboard Toggle word wrap
    1
    <my_product_secrets > 是您首选的 Developer Hub secret 名称,其中 < my_product_secrets > 指定 Developer Hub 中 secret 配置的标识符。
  7. 将 CR 清单应用到您的命名空间:

    kubectl -n my-rhdh-project apply -f rhdh.yaml
    Copy to Clipboard Toggle word wrap
  8. 使用 URL 访问部署的 Developer Hub: https://<app_address& gt;,其中 < app_address > 是前面获取的 Ingress 地址(例如 https://108.141.70.228)。
  9. 可选: 要删除 CR,请运行以下命令:

    kubectl -n my-rhdh-project delete -f rhdh.yaml
    Copy to Clipboard Toggle word wrap

您可以在 Azure Kubernetes Service (AKS)上部署 Developer Hub 应用程序,以访问用于构建、测试和部署应用程序的综合解决方案。

先决条件

  • 您有一个带有有效订阅的 Microsoft Azure 帐户。
  • 已安装 Azure CLI
  • 已安装 kubectl CLI
  • 使用 kubectl 登录集群,并具有 开发人员或 admin 权限。
  • 已安装 Helm 3 或最新的。

特定于基本 Developer Hub 部署的 AKS 的比较

  • 权限问题 : Developer Hub 容器可能会遇到权限相关的错误,如尝试某些操作时 Permission denied可以通过调整 PodSpec.securityContext 中的 fsGroup 来解决此错误。
  • Ingress 配置 :在 AKS 中,配置 ingress 对于访问已安装的 Developer Hub 实例至关重要。访问 Developer Hub 实例需要使用以下命令启用 Routing 附加组件(基于 NGINX 的 Ingress Controller):

    az aks approuting enable --resource-group <your_ResourceGroup> --name <your_ClusterName>
    Copy to Clipboard Toggle word wrap
    提示

    您可能需要安装 Azure CLI 扩展 aks-preview。如果没有自动安装扩展,您可能需要使用以下命令手动安装它:

    az extension add --upgrade -n aks-preview --allow-preview true
    Copy to Clipboard Toggle word wrap
    注意

    安装 Ingress Controller 后,集群中将部署带有 Ingress Controller 的 app-routing-system 命名空间。请注意已安装的 Ingress Controller 的 Developer Hub 应用程序地址(例如,108.141.70.228)),以便以后访问 Developer Hub 应用程序,稍后被引用为 < app_address>

    kubectl get svc nginx --namespace app-routing-system -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
    Copy to Clipboard Toggle word wrap
  • 命名空间 管理 :您可以使用以下命令为 AKS 中的 Developer Hub 部署创建专用命名空间:

    kubectl create namespace <your_namespace>
    Copy to Clipboard Toggle word wrap

流程

  1. 运行以下命令登录到 AKS:

    az login [--tenant=<optional_directory_name>]
    Copy to Clipboard Toggle word wrap
  2. 运行以下命令来创建资源组:

    az group create --name <resource_group_name> --location <location>
    Copy to Clipboard Toggle word wrap
    提示

    您可以运行以下命令来列出可用的区域:

    az account list-locations -o table
    Copy to Clipboard Toggle word wrap
  3. 运行以下命令来创建 AKS 集群:

    az aks create \
    --resource-group <resource_group_name> \
    --name <cluster_name> \
    --enable-managed-identity \
    --generate-ssh-keys
    Copy to Clipboard Toggle word wrap

    您可以参阅- -help 来获得其他选项。

  4. 运行以下命令来连接到集群:

    az aks get-credentials --resource-group <resource_group_name> --name <cluster_name>
    Copy to Clipboard Toggle word wrap

    上一命令配置 Kubernetes 客户端,并将 kubeconfig 中的当前上下文设置为指向您的 AKS 集群。

  5. 打开终端并运行以下命令来添加 Helm Chart 仓库:

    helm repo add openshift-helm-charts https://charts.openshift.io/
    Copy to Clipboard Toggle word wrap
  6. 创建并激活 < my-rhdh-project> 命名空间:

    DEPLOYMENT_NAME=<redhat-developer-hub>
    NAMESPACE=<rhdh>
    kubectl create namespace ${NAMESPACE}
    kubectl config set-context --current --namespace=${NAMESPACE}
    Copy to Clipboard Toggle word wrap
  7. 运行以下命令,创建一个 pull secret,用于从红帽生态系统拉取 Developer Hub 镜像:

    kubectl -n $NAMESPACE create secret docker-registry rhdh-pull-secret \
        --docker-server=registry.redhat.io \
        --docker-username=<redhat_user_name> \
        --docker-password=<redhat_password> \
        --docker-email=<email>
    Copy to Clipboard Toggle word wrap
  8. 使用以下模板创建一个名为 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
    Copy to Clipboard Toggle word wrap
  9. 要使用 Helm Chart 安装 Developer Hub,请运行以下命令:

    helm -n $NAMESPACE install -f values.yaml $DEPLOYMENT_NAME openshift-helm-charts/redhat-developer-hub --version 1.7.0
    Copy to Clipboard Toggle word wrap
  10. 验证部署状态:

    kubectl get deploy $DEPLOYMENT_NAME -n $NAMESPACE
    Copy to Clipboard Toggle word wrap
  11. 使用集群中的 Developer Hub 数据库密码和路由器基本 URL 值配置 Developer Hub Helm Chart 实例:

    PASSWORD=$(kubectl get secret redhat-developer-hub-postgresql -o jsonpath="{.data.password}" | base64 -d)
    CLUSTER_ROUTER_BASE=$(kubectl get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//')
    helm upgrade $DEPLOYMENT_NAME -i "https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.7.0/redhat-developer-hub-1.7.0.tgz" \
        --set global.clusterRouterBase="$CLUSTER_ROUTER_BASE" \
        --set global.postgresql.auth.password="$PASSWORD"
    Copy to Clipboard Toggle word wrap
  12. 运行以下命令,显示正在运行的 Developer Hub 实例 URL:

    echo "https://$DEPLOYMENT_NAME-$NAMESPACE.$CLUSTER_ROUTER_BASE"
    Copy to Clipboard Toggle word wrap

验证

  • 在浏览器中打开正在运行的 Developer Hub 实例 URL,以使用 Developer Hub。

Upgrade(升级)

  • 要升级部署,请运行以下命令:

    helm upgrade $DEPLOYMENT_NAME -i https://github.com/openshift-helm-charts/charts/releases/download/redhat-redhat-developer-hub-1.7.0/redhat-developer-hub-1.7.0.tgz
    Copy to Clipboard Toggle word wrap

删除

  • 要删除部署,请运行以下命令:

    helm -n $NAMESPACE delete $DEPLOYMENT_NAME
    Copy to Clipboard Toggle word wrap

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat