动态PVC 应用配置文件 以csistorageclasslocalstatefulstor1lun10.yaml为例。 plaintext [root@server statefulset] kubectl apply f csistorageclasslocalstatefulstor1lun10.yaml storageclass.storage.k8s.io/csistorageclasslocalstatefulstor1lun10 created 创建StatefulSet 新建StatefulSet的YAML配置文件 卷模式为filesystem,创建StatefulSet csiappstatefullocalstor1lun10的YAML配置文件csiappstatefullocalstor1lun10.yaml。可以参考examplesfilesystemvolumesstatefulsetcsiappstatefullocal.yaml中的示例。 plaintext apiVersion: v1 kind: Service metadata: name: csiappstatefullocalstor1lun10 Set to the actual namespace namespace: default HBlock CSI安装时绑定的命名空间名称。 labels: app: csiappstatefullocalstor1lun10 spec: ports: port: 80 name: web clusterIP: None selector: app: csiappstatefullocalstor1lun10 apiVersion: apps/v1 kind: StatefulSet metadata: name: csiappstatefullocalstor1lun10 Set to the actual namespace namespace: default HBlock CSI安装时绑定的命名空间名称。 spec: selector: matchLabels: app: csiappstatefullocalstor1lun10 serviceName: "csiappstatefullocalstor1lun10" replicas: 2 template: metadata: labels: app: csiappstatefullocalstor1lun10 spec: terminationGracePeriodSeconds: 10 containers: name: csiappstatefullocalstor1lun10 image: busybox ports: containerPort: 80 name: web volumeMounts: name: lun10 mountPath: /test10 command: [ "sleep", "1000000" ] volumeClaimTemplates: metadata: name: lun10 spec: accessModes: [ "ReadWriteOnce" ]