Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentations for volume resizing
- Loading branch information
Cheng Pan
committed
Aug 11, 2019
1 parent
f23d7d7
commit e85af77
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## Volume Resizing | ||
This example shows how to resize EBS persistence volume using volume resizing features. | ||
|
||
Note that CSI volume resizing is still alpha as of Kubernetes 1.15. | ||
|
||
## Usage | ||
1. Add `allowVolumeExpansion: true` in the StorageClass spec in [example manifest](./specs/example.yaml) to enable volume expansion. You can only expand a PVC if its storage class’s allowVolumeExpansion field is set to true | ||
|
||
2. Deploy the example: | ||
```sh | ||
kubectl apply -f specs/ | ||
``` | ||
|
||
3. Verify the volume is created and Pod is running: | ||
```sh | ||
kubectl get pv | ||
kubectl get po app | ||
``` | ||
|
||
4. Expand the volume size by increasing the capacity in PVC's `spec.resources.requests.storage`: | ||
```sh | ||
kubectl edit pvc ebs-claim | ||
``` | ||
Save the result at the end of the edit. | ||
|
||
5. Verify that both the persistence volume and persistence volume claim are resized: | ||
```sh | ||
kubectl get pv | ||
kubectl get pvc | ||
``` | ||
You should see that both should have the new value relfected in the capacity fields. | ||
|
||
6. Verify that the application is continuously running without any interruption: | ||
```sh | ||
kubectl exec -it app cat /data/out.txt | ||
``` | ||
|
||
7. Cleanup resources: | ||
``` | ||
kubectl delete -f specs/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: resize-sc | ||
provisioner: ebs.csi.aws.com | ||
allowVolumeExpansion: true | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ebs-claim | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: resize-sc | ||
resources: | ||
requests: | ||
storage: 4Gi | ||
--- | ||
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-claim |