在 Amazon Elastic Kubernetes Service 上安装 Red Hat Developer Hub


Red Hat Developer Hub 1.5

使用 Operator 或 Helm chart 在 Amazon Elastic Kubernetes Service (EKS)上运行 Red Hat Developer Hub

Red Hat Customer Content Services

摘要

平台管理员可以配置角色、权限和其他设置,以使其他授权用户能够使用 Operator 或 Helm Chart 在 Amazon Elastic Kubernetes Service (EKS)上部署 Developer Hub 实例。

前言

您可以使用以下方法之一在 Amazon Elastic Kubernetes Service (EKS)上安装 Red Hat Developer Hub:

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

第 1 章 使用 Operator 在 EKS 上安装 Developer Hub

Red Hat Developer Hub Operator 安装需要 Operator Lifecycle Manager (OLM)框架。

其他资源

1.1. 使用 OLM 框架安装 Developer Hub Operator

您可以使用 Operator Lifecycle Manager (OLM)框架在 EKS 上安装 Developer Hub Operator。之后,您可以继续在 EKS 中部署 Developer Hub 实例。

先决条件

流程

  1. 在终端中运行以下命令,以创建安装 Operator 的 rhdh-operator 命名空间:

    kubectl create namespace rhdh-operator
    Copy to Clipboard
  2. 使用以下命令创建 pull secret:

    kubectl -n rhdh-operator create secret docker-registry rhdh-pull-secret \
        --docker-server=registry.redhat.io \
        --docker-username=<user_name> \ 
    1
    
        --docker-password=<password> \ 
    2
    
        --docker-email=<email> 
    3
    Copy to Clipboard
    1
    在命令中输入您的用户名。
    2
    在命令中输入您的密码。
    3
    在命令中输入您的电子邮件地址。

    创建的 pull secret 用于从红帽生态系统中拉取 Developer Hub 镜像。

  3. 创建一个包含红帽生态系统中的 Operator 的 CatalogSource 资源:

    cat <<EOF | kubectl -n rhdh-operator apply -f -
    apiVersion: operators.coreos.com/v1alpha1
    kind: CatalogSource
    metadata:
      name: redhat-catalog
    spec:
      sourceType: grpc
      image: registry.redhat.io/redhat/redhat-operator-index:v4.18
      secrets:
      - "rhdh-pull-secret"
      displayName: Red Hat Operators
    EOF
    Copy to Clipboard
  4. 按如下所示创建 OperatorGroup 资源:

    cat <<EOF | kubectl apply -n rhdh-operator -f -
    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      name: rhdh-operator-group
    EOF
    Copy to Clipboard
  5. 使用以下代码创建 Subscription 资源:

    cat <<EOF | kubectl apply -n rhdh-operator -f -
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: rhdh
      namespace: rhdh-operator
    spec:
      channel: fast
      installPlanApproval: Automatic
      name: rhdh
      source: redhat-catalog
      sourceNamespace: rhdh-operator
      startingCSV: rhdh-operator.v1.5.2
    EOF
    Copy to Clipboard
  6. 运行以下命令,以验证创建的 Operator 是否正在运行:

    kubectl -n rhdh-operator get pods -w
    Copy to Clipboard

    如果 Operator pod 显示 ImagePullBackOff 状态,则可能需要权限直接在 Operator 部署清单中拉取镜像。

    提示

    您可以在 deployment.spec.template.spec.imagePullSecrets 列表中包括所需的 secret 名称,并使用 kubectl get deployment -n rhdh-operator 命令验证部署名称:

    kubectl -n rhdh-operator patch deployment \
        rhdh.fast --patch '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"rhdh-pull-secret"}]}}}}' \
        --type=merge
    Copy to Clipboard

1.2. 使用 Operator 在 EKS 上部署 Developer Hub 实例

先决条件

流程

  1. 使用以下模板创建一个包含 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://<rhdh_dns_name>
        backend:
          auth:
            externalAccess:
                - type: legacy
                  options:
                    subject: legacy-default-config
                    secret: "${BACKEND_SECRET}"
          baseUrl: https://<rhdh_dns_name>
          cors:
            origin: https://<rhdh_dns_name>
    Copy to Clipboard
  2. 创建一个 Red Hat Developer Hub secret,并添加名为 BACKEND_SECRET 的键,其带有 Base64 编码的字符串 作为值:

    apiVersion: v1
    kind: Secret
    metadata:
      name: <my_product_secrets> 
    1
    
    stringData:
      # TODO: See https://backstage.io/docs/auth/service-to-service-auth/#setup
      BACKEND_SECRET: "xxx"
    Copy to Clipboard
    1
    <my_product_secrets > 是您首选的 Developer Hub secret 名称,其中 < my_product_secrets > 指定 Developer Hub 中 secret 配置的唯一标识符。
    重要

    确保为每个 Developer Hub 实例使用唯一的 BACKEND_SECRET 值。

    您可以使用以下命令生成密钥:

    node-p'require("crypto").randomBytes(24).toString("base64")'
    Copy to Clipboard
  3. 要启用从 Red Hat Ecosystem Catalog 拉取 PostgreSQL 镜像,请在部署 Developer Hub 实例的命名空间中的 default 服务帐户中添加镜像 pull secret:

    kubectl patch serviceaccount default \
        -p '{"imagePullSecrets": [{"name": "rhdh-pull-secret"}]}' \
        -n <your_namespace>
    Copy to Clipboard
  4. 使用以下模板创建 Backstage 自定义资源:

    apiVersion: rhdh.redhat.com/v1alpha3
    kind: Backstage
    metadata:
     # TODO: this the name of your Developer Hub instance
      name: my-rhdh
    spec:
      application:
        imagePullSecrets:
        - "rhdh-pull-secret"
        route:
          enabled: false
        appConfig:
          configMaps:
            - name: my-rhdh-app-config
        extraEnvs:
          secrets:
            - name: <my_product_secrets> 
    1
    Copy to Clipboard
    1
    <my_product_secrets > 是您首选的 Developer Hub secret 名称,其中 < my_product_secrets > 指定 Developer Hub 中 secret 配置的标识符。
  5. 使用以下模板创建 Ingress 资源,确保根据需要自定义名称:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      # TODO: this the name of your Developer Hub Ingress
      name: my-rhdh
      annotations:
        alb.ingress.kubernetes.io/scheme: internet-facing
    
        alb.ingress.kubernetes.io/target-type: ip
    
        # 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:us-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: <rhdh_dns_name>
    
    spec:
      ingressClassName: alb
      rules:
        # TODO: Set your application domain name.
        - host: <rhdh_dns_name>
          http:
            paths:
            - path: /
              pathType: Prefix
              backend:
                service:
                  # TODO: my-rhdh is the name of your `Backstage` custom resource.
                  # Adjust if you changed it!
                  name: backstage-my-rhdh
                  port:
                    name: http-backend
    Copy to Clipboard

    在前面的模板中,将 ' <rhdh_dns_name>' 替换为您的 Developer Hub 域名,并将 alb.ingress.kubernetes.io/certificate-arn 的值替换为您的证书 ARN。

验证

等待 DNS 名称响应,这表示您的 Developer Hub 实例已准备就绪。

第 2 章 使用 Helm Chart 在 EKS 上安装 Developer Hub

当您在 Elastic Kubernetes Service (EKS)中安装 Developer Hub Helm Chart 时,它会编配 Developer Hub 实例的部署,它在 AWS 生态系统中提供了强大的开发人员平台。

先决条件

流程

  1. 进入终端并运行以下命令,将包含 Developer Hub chart 的 Helm Chart 仓库添加到本地 Helm registry 中:

    helm repo add openshift-helm-charts https://charts.openshift.io/
    Copy to Clipboard
  2. 使用以下命令创建 pull secret:

    kubectl create secret docker-registry rhdh-pull-secret \
        --docker-server=registry.redhat.io \
        --docker-username=<user_name> \ 
    1
    
        --docker-password=<password> \ 
    2
    
        --docker-email=<email> 
    3
    Copy to Clipboard
    1
    在命令中输入您的用户名。
    2
    在命令中输入您的密码。
    3
    在命令中输入您的电子邮件地址。

    创建的 pull secret 用于从红帽生态系统中拉取 Developer Hub 镜像。

  3. 使用以下模板创建一个名为 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
    Copy to Clipboard
  4. 在终端中运行以下命令,以使用最新版本的 Helm Chart 并使用上一步中创建的 values.yaml 文件部署 Developer Hub:

    helm install rhdh \
      openshift-helm-charts/redhat-developer-hub \
      [--version 1.5.2] \
      --values /path/to/values.yaml
    Copy to Clipboard
注意

验证

等待 DNS 名称响应,这表示您的 Developer Hub 实例已准备就绪。

法律通告

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