日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

使用存儲卷

本文介紹如何在工作流集群中掛載使用存儲卷。

使用說明

在工作流集群中支持使用OSS存儲卷、NAS存儲卷和CPFS2.0存儲卷

使用OSS存儲卷

  1. 使用以下示例代碼,創建OSS存儲卷。

    更多信息,請參見使用OSS靜態存儲卷。如果使用其他類型存儲卷,請替換對應的參數。

    展開查看使用OSS存儲卷的YAML示例代碼

    apiVersion: v1
    kind: Secret
    metadata:
      name: oss-secret
      namespace: default
    stringData:
      akId: <yourAccessKey ID> # akId需要替換為您的AccessKey ID。
      akSecret: <yourAccessKey Secret> # akSecret需要替換為您的AccessKey Secret。
    ---
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: pv-oss
      labels:
        alicloud-pvname: pv-oss
    spec:
      capacity:
        storage: 5Gi
      accessModes:
        - ReadWriteMany
      persistentVolumeReclaimPolicy: Retain
      csi:
        driver: ossplugin.csi.alibabacloud.com
        volumeHandle: pv-oss   # 需要和PV名字一致。
        nodePublishSecretRef:
          name: oss-secret
          namespace: default
        volumeAttributes:
          bucket: <your bucket name> # 需要替換為您的Bucket名稱。
          url: "oss-<your region id>-internal.aliyuncs.com" # 需要替換<your region id>為您OSS的地域ID,例如華北2(北京)地域為:oss-cn-beijing-internal.aliyuncs.com。
          otherOpts: "-o max_stat_cache_size=0 -o allow_other -o multipart_size=30 -o parallel_count=20" # -o max_stat_cache_size=0
          path: "/"  #掛載bucket根目錄,也可以設置此參數掛載bucket下子目錄,例如: path: "testdir/testdir1"
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: pvc-oss
      namespace: default
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 5Gi
      selector:
        matchLabels:
          alicloud-pvname: pv-oss

    可選參數:

    您可以為OSS存儲卷輸入定制化參數,格式為-o *** -o ***,例如-o umask=022 -o max_stat_cache_size=0 -o allow_other

    • umask:用于更改ossfs讀文件的權限。例如,設置umask=022后,ossfs文件的權限都會變更為755。通過SDK、OSS控制臺等其他方式上傳的文件在ossfs中默認權限均為640。因此,建議您在讀寫分離場景中配置umask權限。

    • max_stat_cache_size:用于指定文件元數據的緩存空間,可緩存多少個文件的元數據。元數據緩存可加快ls操作速度。但若通過其他例如OSS、SDK、控制臺、ossutil等方式修改文件,可能會導致元數據未被及時更新。

    • allow_other:賦予計算機上其他用戶訪問掛載目錄的權限,但不包含目錄內的文件。

    更多可選參數,請參見選項列表

  2. 使用以下示例代碼,創建工作流使用存儲卷。

    展開查看在工作流中掛載使用OSS存儲卷的YAML示例代碼

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: volumes-existing-
      namespace: default
    spec:
      entrypoint: volumes-existing-example
      volumes:
      # Pass my-existing-volume as an argument to the volumes-existing-example template.
      # Same syntax as k8s Pod spec.
      - name: workdir
        persistentVolumeClaim:
          claimName: pvc-oss
    
      templates:
      - name: volumes-existing-example
        steps:
        - - name: generate
            template: whalesay
        - - name: print
            template: print-message
    
      - name: whalesay
        container:
          image: docker/whalesay:latest
          command: [sh, -c]
          args: ["echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol
    
      - name: print-message
        container:
          image: alpine:latest
          command: [sh, -c]
          args: ["echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol

使用NAS存儲卷

  1. 使用以下示例代碼,創建靜態NAS共享卷。

    展開查看使用NAS共享卷的YAML示例代碼

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: pv-nas
      labels:
        alicloud-pvname: pv-nas
    spec:
      capacity:
        storage: 100Gi
      accessModes:
        - ReadWriteMany
      csi:
        driver: nasplugin.csi.alibabacloud.com
        volumeHandle: pv-nas   # 必須與PV Name保持一致。
        volumeAttributes:
          server: "<your nas filesystem id>.cn-beijing.nas.aliyuncs.com"
          path: "/"
      mountOptions:
      - nolock,tcp,noresvport
      - vers=3
    ---
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: pvc-nas
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 100Gi
      selector:
        matchLabels:
          alicloud-pvname: pv-nas
  2. 使用以下示例代碼,在工作流中掛載和使用NAS。

    展開查看在工作流中掛載使用NAS共享卷的YAML示例代碼

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: volumes-existing-
      namespace: default
    spec:
      entrypoint: volumes-existing-example
      volumes:
      # Pass my-existing-volume as an argument to the volumes-existing-example template.
      # Same syntax as k8s Pod spec.
      - name: workdir
        persistentVolumeClaim:
          claimName: pvc-nas
    
      templates:
      - name: volumes-existing-example
        steps:
        - - name: generate
            template: whalesay
        - - name: print
            template: print-message
    
      - name: whalesay
        container:
          image: docker/whalesay:latest
          command: [sh, -c]
          args: ["echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol
    
      - name: print-message
        container:
          image: alpine:latest
          command: [sh, -c]
          args: ["echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol

使用CPFS2.0存儲卷

  1. 執行以下命令,創建CPFS2.0共享卷。

    展開查看使用CPFS2.0共享卷的YAML示例代碼

    cat << EOF | kubectl apply -f -
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: pv-cpfs
      labels:
        alicloud-pvname: pv-cpfs
    spec:
      accessModes:
      - ReadWriteOnce
      capacity:
        storage: 1000Gi
      csi:
        driver: nasplugin.csi.alibabacloud.com
        volumeAttributes:
          mountProtocol: cpfs-nfs             # 掛載時,使用NFS協議進行掛載。
          path: "/share"                      # 掛載目錄必須以/share為前綴。
          volumeAs: subpath
          server: "<your cpfs id, e.g cpfs-****>.<regionID>.cpfs.aliyuncs.com"      # 為掛載點前面的域名。
        volumeHandle: pv-cpfs # 必須與PV Name保持一致。
      mountOptions:
      - rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport
      - vers=3
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: pvc-cpfs
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1000Gi
      selector:
        matchLabels:
          alicloud-pvname: cpfs-pv
    EOF
  2. 使用以下示例代碼,在工作流中掛載和使用CPFS2.0。

    展開查看在工作流中掛載使用CPFS2.0共享卷的YAML示例代碼

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: volumes-existing-
      namespace: default
    spec:
      entrypoint: volumes-existing-example
      volumes:
      # Pass my-existing-volume as an argument to the volumes-existing-example template.
      # Same syntax as k8s Pod spec.
      - name: workdir
        persistentVolumeClaim:
          claimName: pvc-cpfs
    
      templates:
      - name: volumes-existing-example
        steps:
        - - name: generate
            template: whalesay
        - - name: print
            template: print-message
    
      - name: whalesay
        container:
          image: docker/whalesay:latest
          command: [sh, -c]
          args: ["echo generating message in volume; cowsay hello world | tee /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol
    
      - name: print-message
        container:
          image: alpine:latest
          command: [sh, -c]
          args: ["echo getting message from volume; find /mnt/vol; cat /mnt/vol/hello_world.txt"]
          volumeMounts:
          - name: workdir
            mountPath: /mnt/vol