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


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

流程

  1. 获取名为 rhdh-operator-<VERSION>.yaml 的 Red Hat Developer Hub Operator 清单文件,并通过添加以下片段来修改 db-statefulset.yamldeployment.yaml 的默认配置:

    securityContext:
      fsGroup: 300

    以下是清单中的指定位置:

    db-statefulset.yaml: | spec.template.spec
    deployment.yaml: | spec.template.spec
  2. 将修改后的 Operator 清单应用到 Kubernetes 集群:

    kubectl apply -f rhdh-operator-<VERSION>.yaml
    注意

    上一命令的执行是集群范围的,需要适当的集群特权。

  3. 使用您的红帽凭证创建一个名为 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>
  4. 创建名为 rhdh-ingress.yaml 的 Ingress 清单文件,指定 Developer Hub 服务名称,如下所示:

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

    kubectl -n <your_namespace> apply -f rhdh-ingress.yaml
  6. 使用以下示例,创建一个名为 app-config-rhdh 的 ConfigMap,其中包含 Developer Hub 配置:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: app-config-rhdh
    data:
      "app-config-rhdh.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>
  7. 创建名为 secrets-rhdh 的 Secret,并使用 Base64 编码的字符串 值添加名为 BACKEND_SECRET 的键,如下例所示:

    apiVersion: v1
    kind: Secret
    metadata:
      name: secrets-rhdh
    stringData:
      BACKEND_SECRET: "xxx"
  8. 创建名为 rhdh.yaml 的自定义资源(CR)清单文件,并包含之前创建的 rhdh-pull-secret,如下所示:

    apiVersion: rhdh.redhat.com/v1alpha1
    kind: Backstage
    metadata:
      name: <your-rhdh-cr>
    spec:
      application:
        imagePullSecrets:
          - rhdh-pull-secret
        appConfig:
          configMaps:
            - name: "app-config-rhdh"
        extraEnvs:
          secrets:
            - name: "secrets-rhdh"
  9. 将 CR 清单应用到您的命名空间:

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

    kubectl -n <your_namespace> delete -f rhdh.yaml
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部