Background Image

Blog Post

在Amazon Elastic Kubernetes Service (EKS)上實現使用Elastic Block Store (EBS)的StorageClass

Jan 31

EKS 上 StorageClass 實作 EBS


step 1
安裝Amazon EBS CSI驅動器:
kubectl apply -k "github.com/kubernetes-sigs/aws-ebs-csi-driver/deploy/kubernetes/overlays/stable/ecr/?ref=release-1.3"

step 2
建立StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com

step3
建立PersistentVolumeClaim (PVC)

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-pvc
spec:
  storageClassName: ebs-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

step 4
建立Pod:

apiVersion: v1
kind: Pod
metadata:
  name: ebs-pod
spec:
  containers:
  - name: my-container
    image: nginx
    volumeMounts:
    - mountPath: "/mnt/data"
      name: ebs-volume
  volumes:
  - name: ebs-volume
    persistentVolumeClaim:
      claimName: ebs-pvc

 

Back   
 
We're sorry. New comments are no longer being accepted.
1 person will be notified when a comment is added.
Would you like to be notified when a comment is added?
Please login or register first.