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 实例已准备就绪。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat