This documentation is for a release that is no longer maintained
See documentation for the latest supported version.1.2. 使用 Operator 在 EKS 上部署 Developer Hub 实例
先决条件
- 集群管理员已安装了 Red Hat Developer Hub Operator。
- 已安装带有 AWS Application Load Balancer (ALB)附加组件的 EKS 集群。如需更多信息,请参阅 Amazon Elastic Kubernetes Service 上的应用程序负载均衡 和 安装 AWS Load Balancer Controller 附加组件。
- 您已为 Developer Hub 实例配置了域名。域名可以是 Route 53 上的托管区条目,也可以在 AWS 之外管理。如需更多信息,请参阅 将 Amazon Route 53 配置为您的 DNS 服务 文档。
- 您在 AWS 证书管理器(ACM)中有一个条目,用于您首选的域名。确保保留证书 ARN 的记录。
-
您已订阅了
registry.redhat.io
。如需更多信息,请参阅 Red Hat Container Registry 身份验证。 -
在当前
kubeconfig
中将上下文设置为 EKS 集群。如需更多信息,请参阅为 Amazon EKS 集群创建或更新 kubeconfig 文件。 -
已安装
kubectl
。如需更多信息,请参阅 安装或更新 kubectl。
流程
使用以下模板创建一个包含
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>
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 Copied! 创建一个 Red Hat Developer Hub secret,并添加名为
BACKEND_SECRET
的键,其带有Base64 编码的字符串
作为值:apiVersion: v1 kind: Secret metadata: name: <my_product_secrets> stringData: # TODO: See https://backstage.io/docs/auth/service-to-service-auth/#setup BACKEND_SECRET: "xxx"
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 Copied! - 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")'
node-p'require("crypto").randomBytes(24).toString("base64")'
Copy to Clipboard Copied! 要启用从 Red Hat Ecosystem Catalog 拉取 PostgreSQL 镜像,请在部署 Developer Hub 实例的命名空间中的 default 服务帐户中添加镜像 pull secret:
kubectl patch serviceaccount default \ -p '{"imagePullSecrets": [{"name": "rhdh-pull-secret"}]}' \ -n <your_namespace>
kubectl patch serviceaccount default \ -p '{"imagePullSecrets": [{"name": "rhdh-pull-secret"}]}' \ -n <your_namespace>
Copy to Clipboard Copied! 使用以下模板创建
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>
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 Copied! - 1
<my_product_secrets
> 是您首选的 Developer Hub secret 名称,其中 <my_product_secrets
> 指定 Developer Hub 中 secret 配置的标识符。
使用以下模板创建 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
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 Copied! 在前面的模板中,将 ' <rhdh_dns_name>' 替换为您的 Developer Hub 域名,并将
alb.ingress.kubernetes.io/certificate-arn
的值替换为您的证书 ARN。
验证
等待 DNS 名称响应,这表示您的 Developer Hub 实例已准备就绪。