docs:virtualizacion:docker:persistent_volumes_aws

Persistent Volumes at AWS

$ kubectl get storageclass
NAME            PROVISIONER             AGE
default         kubernetes.io/aws-ebs   20h
gp2 (default)   kubernetes.io/aws-ebs   20h

Create volume at AWS and get volume ID.

$ cat volume-aws.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysql-pv
  labels:
    type: amazonEBS
spec:
  capacity:
    storage: 10Gi
  accessModes:
  - ReadWriteOnce
  awsElasticBlockStore:
    fsType: ext4
    volumeID: vol-01df22dd5bb1048ca
  storageClassName: gp2
$ kubectl get pv
NAME       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM     STORAGECLASS   REASON    AGE
mysql-pv   10Gi       RWO            Retain           Available             gp2                      3m
$ kubectl describe pv mysql-pv
Name:            mysql-pv
Labels:          failure-domain.beta.kubernetes.io/region=us-east-1
                 failure-domain.beta.kubernetes.io/zone=us-east-1a
                 type=amazonEBS
Annotations:     kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"labels":{"type":"amazonEBS"},"name":"mysql-pv","namespace":""},"spec":{"acce...
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    gp2
Status:          Available
Claim:
Reclaim Policy:  Retain
Access Modes:    RWO
Capacity:        10Gi
Node Affinity:   <none>
Message:
Source:
    Type:       AWSElasticBlockStore (a Persistent Disk resource in AWS)
    VolumeID:   vol-01df22dd5bb1048ca
    FSType:     ext4
    Partition:  0
    ReadOnly:   false
Events:         <none>
$ cat volume-aws-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pvc
  labels:
    type: amazonEBS
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  volumeName: mysql-pv
$ kubectl get pvc
NAME        STATUS    VOLUME     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
mysql-pvc   Bound     mysql-pv   10Gi       RWO            gp2            1m
$ kubectl get pv
NAME       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM            STORAGECLASS   REASON    AGE
mysql-pv   10Gi       RWO            Retain           Bound     main/mysql-pvc   gp2                      9m
  • docs/virtualizacion/docker/persistent_volumes_aws.txt
  • Última modificación: 2018/09/04 10:28
  • por rodolfo