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>
7.4 KiB
7.4 KiB
(kubectl) Creating a StatefulSet Mounted with an SFS Turbo Volume
Scenario
CCE allows you to use an existing SFS Turbo volume to create a StatefulSet.
Prerequisites
You have created a CCE cluster and installed the FlexVolume plug-in (storage-driver) in the cluster.
Notes and Constraints
The following configuration example applies to clusters of Kubernetes 1.13 or earlier.
Procedure
- Create an SFS Turbo volume and record the volume name.
- Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
- Create a YAML file for creating the workload. Assume that the file name is efs-statefulset-example.yaml.
touch efs-statefulset-example.yaml
vi efs-statefulset-example.yaml
Example YAML:
apiVersion: apps/v1 kind: StatefulSet metadata: name: efs-statefulset-example namespace: default spec: replicas: 1 selector: matchLabels: app: efs-statefulset-example template: metadata: annotations: metrics.alpha.kubernetes.io/custom-endpoints: '[{"api":"","path":"","port":"","names":""}]' pod.alpha.kubernetes.io/initialized: 'true' labels: app: efs-statefulset-example spec: containers: - image: 'nginx:1.0.0' name: container-0 resources: requests: {} limits: {} env: - name: PAAS_APP_NAME value: efs-statefulset-example - name: PAAS_NAMESPACE value: default - name: PAAS_PROJECT_ID value: b18296881cc34f929baa8b9e95abf88b volumeMounts: - name: efs-statefulset-example mountPath: /tmp readOnly: false subPath: '' imagePullSecrets: - name: default-secret terminationGracePeriodSeconds: 30 volumes: - persistentVolumeClaim: claimName: cce-efs-import-jnr481gm-3y5o name: efs-statefulset-example affinity: {} tolerations: - key: node.kubernetes.io/not-ready operator: Exists effect: NoExecute tolerationSeconds: 300 - key: node.kubernetes.io/unreachable operator: Exists effect: NoExecute tolerationSeconds: 300 podManagementPolicy: OrderedReady serviceName: test updateStrategy: type: RollingUpdate
Table 1 Key parameters Parameter
Description
replicas
Number of pods.
name
Name of the created workload.
image
Image used by the workload.
mountPath
Mount path in the container.
serviceName
Service corresponding to the workload. For details about how to create a Service, see Creating a StatefulSet.
claimName
Name of an existing PVC.
- Create the StatefulSet.
kubectl create -f efs-statefulset-example.yaml
Parent topic: Using SFS Turbo File Systems as Storage Volumes