Batch Computing
Prerequisites
Prepare a VM or node that can run the kubectl commands and configure kubectl. For details, click the Kubectl tab on the CCE cluster details page.
EVS
During the use of EVS, expected EVS disks can be automatically created and attached. Currently, high I/O and ultra-high I/O are supported, which correspond to sas and ssd respectively.
- Log in to an available VM or node.
- Configure the pvc-evs-auto-example.yaml file for creating a PVC.
touch pvc-evs-auto-example.yaml
vi pvc-evs-auto-example.yaml
Example:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-evs-auto-example namespace: default annotations: volume.beta.kubernetes.io/storage-class: sas volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxivol labels: failure-domain.beta.kubernetes.io/region: cn-north-4 failure-domain.beta.kubernetes.io/zone: cn-north-4a spec: accessModes: - ReadWriteMany resources: requests: storage: 10GiWhere,
- volume.beta.kubernetes.io/storage-class is the EVS disk type. Currently, high I/O (SAS) and ultra-high I/O (SSD) are supported.
- For volume.beta.kubernetes.io/storage-provisioner, flexvolume-huawei.com/fuxivol must be used.
- failure-domain.beta.kubernetes.io/region indicates the region where the cluster is located.
- failure-domain.beta.kubernetes.io/zone indicates the AZ where the EVS disk is created. It must be the same as the AZ planned for the workload. For details, see Regions and Endpoints.
- storage indicates the storage capacity (unit: Gi).
- Create a PVC.
./kubectl create -f pvc-evs-auto-example.yaml
- Configure the evs-pod-example.yaml file to create a pod.
touch evs-pod-example.yaml
vi evs-pod-example.yaml
Example:
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: evs-pod-example namespace: default spec: replicas: 1 selector: matchLabels: app: evs-pod-example template: metadata: labels: app: evs-pod-example spec: containers: - image: nginx name: container-0 volumeMounts: - mountPath: /tmp name: pvc-evs-auto-example restartPolicy: Always volumes: - name: pvc-evs-auto-example persistentVolumeClaim: claimName: pvc-evs-auto-example
Where,
- name indicates the name of the pod to be created.
- app indicates the name of a pod workload.
- image indicates the download address of an image.
- mountPath indicates a mounting path.
- Create a pod.
./kubectl create -f evs-pod-example.yaml
- After the pod is created, log in to the CCE console, choose Resource Management > Storage in the navigation pane, and then click the EVS tab to view the binding relationship between the workload and PVC.
SFS
During the use of SFS, expected file systems can be automatically created and attached.
- Log in to an available VM or node.
- Configure the pvc-sfs-auto-example.yaml file to create a PVC.
touch pvc-sfs-auto-example.yaml
vi pvc-sfs-auto-example.yaml
Example:
apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: volume.beta.kubernetes.io/storage-class: nfs-rw volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxinfs name: pvc-sfs-auto-example namespace: default spec: accessModes: - ReadWriteMany resources: requests: storage: 10GiWhere,
- name indicates the name of the PVC to be created.
- storage indicates the storage capacity (unit: Gi).
- Create a PVC.
./kubectl create -f pvc-sfs-auto-example.yaml
- Configure the sfs-pod-example.yaml file to create a pod.
touch sfs-pod-example.yaml
vi sfs-pod-example.yaml
Example:
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: sfs-pod-example namespace: default spec: replicas: 1 selector: matchLabels: app: sfs-pod-example template: metadata: labels: app: sfs-pod-example spec: containers: - image: nginx name: container-0 volumeMounts: - mountPath: /tmp name: pvc-sfs-auto-example restartPolicy: Always volumes: - name: pvc-sfs-auto-example persistentVolumeClaim: claimName: pvc-sfs-auto-example
Where,
- name indicates the name of the pod to be created.
- app indicates the name of a pod workload.
- image indicates the download address of an image.
- mountPath indicates a mounting path.
- Create a pod.
./kubectl create -f sfs-pod-example.yaml
- After the pod is created, log in to the CCE console, choose Resource Management > Storage in the navigation pane, and then click the SFS tab to view the binding relationship between the workload and PVC.
OBS
During the use of OBS, expected OBS buckets can be automatically created and attached. Currently, standard and infrequent access OBS buckets are supported, which correspond to obs-standard and obs-standard-ia respectively.
- Log in to an available VM or node.
- Configure the pvc-obs-auto-example.yaml file for creating a PVC.
touch pvc-obs-auto-example.yaml
vi pvc-obs-auto-example.yaml
Example:
apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: volume.beta.kubernetes.io/storage-class: obs-standard volume.beta.kubernetes.io/storage-provisioner: flexvolume-huawei.com/fuxiobs name: pvc-obs-auto-example namespace: default spec: accessModes: - ReadWriteMany resources: requests: storage: 1GiWhere,
- volume.beta.kubernetes.io/storage-class indicates the bucket specification. Currently, both obs-standard and obs-standard-ia are supported
- name indicates the name of the PVC to be created.
- storage indicates the storage capacity (unit: Gi).
- Create a PVC.
./kubectl create -f pvc-obs-auto-example.yaml
- Configure the obs-pod-example.yaml file for creating a pod.
touch obs-pod-example.yaml
vi obs-pod-example.yaml
Example:
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: obs-pod-example namespace: default spec: replicas: 1 selector: matchLabels: app: obs-pod-example template: metadata: labels: app: obs-pod-example spec: containers: - image: nginx name: container-0 volumeMounts: - mountPath: /tmp name: pvc-obs-auto-example restartPolicy: Always volumes: - name: pvc-obs-auto-example persistentVolumeClaim: claimName: pvc-obs-auto-example
Where,
- name indicates the name of the pod to be created.
- app indicates the name of a pod workload.
- image indicates the download address of an image.
- mountPath indicates a mounting path.
- Create a pod.
./kubectl create -f obs-pod-example.yaml
- After the pod is created, log in to the CCE console, choose Resource Management > Storage in the navigation pane, and then click the OBS tab to view the binding relationship between the workload and PVC.
Last Article: Publishing an HTTPS Ingress to ELB (Example)
Next Article: Using Kubeflow and Volcano to Train an AI Model
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.