写pod的yaml文件时,如果想使用云存储,则volumeMounts这个property,
mountPath 为container内部目录
而subPath 虽然紧跟mountpath, 最容易被误解为本地路径,其实其为远端云存储上的子路径

所以进入pod内部看磁盘情况,显示
bbuser@stream-notifications-baseline-learn-tomcat-7cd697-2xwp7:~$ df -v
Filesystem 1K-blocks Used Available Use% Mounted on
10.114.70.2:/learn_perf_bbcontent_1/instance/stream-notifications-baseline 570422592 19338048 551084544 4% /mnt/bbcontent

- name: learn
        image: ${LEARN_DOCKER_IMAGE}
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: ${LEARN_CPU_REQUEST}
            memory: ${LEARN_MEM_REQUEST}
          limits:
            cpu: ${LEARN_CPU_LIMITS}
            memory: ${LEARN_MEM_LIMITS}
        command:
        - ${BB_USER_HOME}/bin/launcher.sh
        env:
        - name: DEV_FEATURES
          valueFrom:
            configMapKeyRef:
              name: ${INSTANCE_NAME}-learn-config
              key: DEV_FEATURES
        volumeMounts:
        - name: bbcontent
          **mountPath: /mnt/bbcontent
          subPath: instance/${INSTANCE_NAME} **
   volumes:
      - name: bbcontent
        persistentVolumeClaim:
          claimName: learn-deployments-share

volume 和name(container的名字)是统一层级。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐