forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
4.2 KiB
4.2 KiB
Creating a Deployment Mounted with an SFS Volume
Scenario
After an SFS volume is created or imported to CCE, you can mount the volume to a workload.
Prerequisites
You have created a CCE cluster and installed the CSI plug-in (everest) in the cluster.
Notes and Constraints
The following configuration example applies to clusters of Kubernetes 1.15 or later.
Procedure
- Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
- Run the following commands to configure the sfs-deployment-example.yaml file, which is used to create a pod.
touch sfs-deployment-example.yaml
vi sfs-deployment-example.yaml
Example of mounting an SFS volume to a Deployment (PVC-based, shared volume):apiVersion: apps/v1 kind: Deployment metadata: name: sfs-deployment-example # Workload name namespace: default spec: replicas: 1 selector: matchLabels: app: sfs-deployment-example template: metadata: labels: app: sfs-deployment-example spec: containers: - image: nginx name: container-0 volumeMounts: - mountPath: /tmp # Mount path name: pvc-sfs-example imagePullSecrets: - name: default-secret restartPolicy: Always volumes: - name: pvc-sfs-example persistentVolumeClaim: claimName: pvc-sfs-auto-example # PVC name
- Run the following command to create the workload:
kubectl create -f sfs-deployment-example.yaml
Parent topic: SFS Volumes