Overview
Storage GP2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# ******************************** # create storage # ******************************** cat storage.yml kind: StorageClass apiVersion: storage.k8s.io/v1beta1 metadata: name: standard provisioner: kubernetes.io/aws-ebs parameters: type: gp2 zone: eu-central-1a |
get all storages
1 2 3 4 5 |
kubectl get sc NAME PROVISIONER AGE default kubernetes.io/aws-ebs 1h gp2 (default) kubernetes.io/aws-ebs 1h standard kubernetes.io/aws-ebs 5m |
Example of usage GP2 general purpose storage on AWS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# ******************************** # mount GP2 - general purpose # storage # ******************************** cat helloworld-with-volume.yml ... apiVersion: extensions/v1beta1 kind: Deployment metadata: name: helloworld-deployment spec: replicas: 1 template: metadata: labels: app: helloworld spec: containers: - name: k8s-demo image: wardviaene/k8s-demo ports: - name: nodejs-port containerPort: 3000 volumeMounts: - mountPath: /myvol name: myvolume volumes: - name: myvolume awsElasticBlockStore: volumeID: # insert AWS EBS volumeID here |
Volume claim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# ********************************* # something like pattern for GP2 # storage volume # ********************************* cat pv-claim.yml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: db-storage annotations: volume.beta.kubernetes.io/storage-class: "standard" spec: accessModes: - ReadWriteOnce resources: requests: storage: 8Gi |
Get/list persistent volume claim
1 2 3 |
kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE db-storage Bound pvc-410d57ef-f5ef-11e7-b6dd-02f7313a206c 8Gi RWO standard 13s |
NFS filesystem on AWS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# ************************ # create NFS on AWS # ************************ aws efs create-file-system --creation-token 1020201 { "LifeCycleState": "creating", "OwnerId": "226106667391", "CreationToken": "10202018", "FileSystemId": "fs-10a44c49", "SizeInBytes": { "Value": 0 }, "CreationTime": 1515583187.0, "Encrypted": false, "PerformanceMode": "generalPurpose", "NumberOfMountTargets": 0 } aws efs create-mount-target --file-system-id fs-10a44c49 --subnet-id subnet-44f96a2f --security-groups sg-bf8aa3d5 { "FileSystemId": "fs-10a44c49", "IpAddress": "172.20.37.207", "OwnerId": "226106667391", "MountTargetId": "fsmt-b5a44fec", "NetworkInterfaceId": "eni-e25e16b7", "SubnetId": "subnet-44f96a2f", "LifeCycleState": "creating" } |