aws EBS 提供存储资源
Amazon EBS CSI 驱动程序的安装,请参考https://docs.aws.amazon.com/zh_cn/eks/latest/userguide/ebs-csi.html
storageclass的配置文件 storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ebs-sc01
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: ebs.csi.aws.com
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
parameters:
fsType: ext4
type: gp2
persistentVolumeClaim的配置文件claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ebs-claim01
spec:
accessModes:
- ReadWriteOnce
storageClassName: ebs-sc01
resources:
requests:
storage: 5Gi
测试用的pod, 配置文件pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: app
spec:
containers:
- name: app
image: centos
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
volumeMounts:
- name: persistent-storage
mountPath: /data
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: ebs-claim01