第 9 章 为 Secret 和 PVC 配置默认挂载


您可以在 Red Hat Developer Hub 部署中配置持久性卷声明(PVC)和 Secret 挂载。使用注解定义自定义挂载路径,并指定要将其挂载到的容器。

9.1. 为 Secret 和 PVC 配置挂载路径

默认情况下,挂载路径是 Developer Hub 容器的工作目录。如果没有定义挂载路径,则默认为 /opt/app-root/src

流程

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

    指定 PVC 挂载的位置示例

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: <my_claim>
      annotations:
        rhdh.redhat.com/mount-path: /mount/path/from/annotation
    Copy to Clipboard Toggle word wrap

    其中:

    rhdh.redhat.com/mount-path
    指定 PVC 挂载到哪个挂载路径(本例中为 /mount/path/from/annotation 目录)。
    <my_claim>
    指定要挂载的 PVC。
  2. 要指定 Secret 挂载路径,请在配置文件中添加 rhdh.redhat.com/mount-path 注解,如下例所示:

    指定 Secret 挂载的位置示例

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

    其中:

    <my_secret>
    指定 Secret 名称。
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部