Skip to content

Commit

Permalink
Merge pull request #794 from wongma7/cleanstatic
Browse files Browse the repository at this point in the history
Remove storageclass from static example
  • Loading branch information
k8s-ci-robot authored Mar 12, 2021
2 parents 91eb881 + e44e974 commit e3cf8c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
5 changes: 2 additions & 3 deletions examples/kubernetes/static-provisioning/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Static Provisioning
This example shows how to create and consume persistence volume from exising EBS using static provisioning.
This example shows how to create and consume persistent volume from exising EBS using static provisioning.

## Usage
1. Edit the PersistentVolume spec in [example manifest](./specs/example.yaml). Update `volumeHandle` with EBS volume ID that you are going to use, and update the `fsType` with the filesystem type of the volume. In this example, I have a pre-created EBS volume in us-east-1c availability zone and it is formatted with xfs filesystem.
Expand All @@ -15,7 +15,6 @@ spec:
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
storageClassName: ebs-sc
csi:
driver: ebs.csi.aws.com
volumeHandle: {volumeId}
Expand All @@ -29,7 +28,7 @@ spec:
values:
- us-east-1c
```
Note that node affinity is used here since EBS volume is created in us-east-1c, hence only node in the same AZ can consume this persisence volume.
Note that node affinity is used here since EBS volume is created in us-east-1c, hence only node in the same AZ can consume this persistent volume.

2. Deploy the example:
```sh
Expand Down
41 changes: 16 additions & 25 deletions examples/kubernetes/static-provisioning/specs/example.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain
---
apiVersion: v1
kind: PersistentVolume
metadata:
Expand All @@ -16,19 +8,18 @@ spec:
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
storageClassName: ebs-sc
csi:
driver: ebs.csi.aws.com
volumeHandle: vol-05786ec9ec9526b67
fsType: xfs
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: topology.ebs.csi.aws.com/zone
operator: In
values:
- us-east-1c
- matchExpressions:
- key: topology.ebs.csi.aws.com/zone
operator: In
values:
- us-east-1c
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -37,7 +28,6 @@ metadata:
spec:
accessModes:
- ReadWriteOnce
storageClassName: ebs-sc
resources:
requests:
storage: 50Gi
Expand All @@ -48,14 +38,15 @@ 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
- 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
- name: persistent-storage
persistentVolumeClaim:
claimName: ebs-claim

0 comments on commit e3cf8c1

Please sign in to comment.