2.3. 挂载默认 Secret 和持久性卷声明(PVC)


您可以使用注解配置挂载路径,并为附加到 Red Hat Developer Hub 部署中 Operator 默认资源的 Secret 和持久性卷声明(PVC)指定容器。此方法特定于默认对象,例如 Operator 管理的 Backstage Deployment。

默认情况下,挂载路径为 /opt/app-root/src。要指定不同的路径,请在资源中添加 rhdh.redhat.com/mount-path 注解。

流程

  1. 要指定 PVC 挂载路径,请在配置文件中添加 rhdh.redhat.com/mount-path 注解,如下例所示:

    指定 PVC 挂载路径示例

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: <my_claim> # Specifies the PVC to mount
      annotations:
        # Specifies which mount path the PVC mounts to (in this case, /mount/path/from/annotation directory)
        rhdh.redhat.com/mount-path: /mount/path/from/annotation
    Copy to Clipboard Toggle word wrap

  2. 要指定 Secret 挂载路径,请在配置文件中添加 rhdh.redhat.com/mount-path 注解,如下例所示:

    指定 Secret 挂载的位置示例

    apiVersion: v1
    kind: Secret
    metadata:
      name: <my_secret> # Specifies the Secret name
      annotations:
        rhdh.redhat.com/mount-path: /mount/path/from/annotation
    Copy to Clipboard Toggle word wrap

2.3.2. 将 Secret 和 PVC 挂载到特定容器

默认情况下,Secret 和 PVC 仅挂载到 Red Hat Developer Hub backstage-backend 容器。您可以将 rhdh.redhat.com/containers 注解添加到配置文件中,以指定要挂载到的容器。

流程

  1. 要将 Secret 挂载到 所有容器,请在配置文件中将 rhdh.redhat.com/containers 注解设置为 *

    挂载到所有容器的示例

    apiVersion: v1
    kind: Secret
    metadata:
      name: <my_secret>
      annotations:
        rhdh.redhat.com/containers: *
    Copy to Clipboard Toggle word wrap

    重要

    rhdh.redhat.com/containers 设置为 *,将它挂载到部署中的所有容器。

  2. 要挂载到特定容器,请使用逗号分隔名称:

    分离容器列表的示例

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: <my_claim>
      annotations:
        rhdh.redhat.com/containers: "init-dynamic-plugins,backstage-backend"
    Copy to Clipboard Toggle word wrap

    注意

    此配置将 &lt ;my_claim& gt; PVC 挂载到 init-dynamic-pluginsbackstage-backend 容器。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat