Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove storageclass from static example #794

Merged
merged 1 commit into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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