Skip to content

Commit

Permalink
Adding example for S3 Express use case (#92)
Browse files Browse the repository at this point in the history
* Adding example for S3 Express use case
  • Loading branch information
dlakhaws authored Dec 5, 2023
1 parent 1021838 commit ab48c45
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ Review the [configuration values](https://github.com/awslabs/mountpoint-s3-csi-d
kubectl get pods -n kube-system -l app.kubernetes.io/name=aws-mountpoint-s3-csi-driver
```

### Volume Configuration Example
Follow the [README for examples](https://github.com/awslabs/mountpoint-s3-csi-driver/tree/main/examples/kubernetes/static_provisioning) on using the driver.

### Uninstalling the driver

Uninstall the self-managed Mountpoint for Amazon S3 CSI Driver with either Helm or Kustomize, depending on your installation method. If you are using the driver as an EKS add-on, see the [EKS documentation](https://docs.aws.amazon.com/eks/latest/userguide/managing-add-ons.html).
Expand Down
4 changes: 3 additions & 1 deletion examples/kubernetes/static_provisioning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ This example shows how to make a static provisioned Mountpoint for S3 persistent
## Examples in this folder
- `static_provisioning.yaml` - spawning a pod which creates a file with name as the current date/time
- `non_root.yaml` - same as above, but the pod is spawned as non-root (uid `1000`, gid `2000`)
- `s3_express_specify_az.yaml` - same as above, but this uses a [S3 Express One Zone](https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-one-zone.html) directory bucket and shows how to specify the availability zone (AZ) of the [pod assignment](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity) to co-locate the pod with the bucket for lower latency access
- Note: This example sets the node affinity to create the pod in an availability zone that matches that of one of the nodes. We have an [open issue](https://github.com/awslabs/mountpoint-s3-csi-driver/issues/93) to support topology to be able to schedule this pods using nodes that match the labels.

## Configure
### Edit [Persistent Volume](https://github.com/awslabs/mountpoint-s3-csi-driver/blob/main/examples/kubernetes/static_provisioning/static_provisioning.yaml)
> Note: This example assumes your S3 bucket has already been created. If you need to create a bucket, follow the [S3 documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html).
> Note: This example assumes your S3 bucket has already been created. If you need to create a bucket, follow the [S3 documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html) for a general purpose bucket or the [S3 Express One Zone documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-create.html) for a directory bucket.
- Bucket name (required): `PersistentVolume -> csi -> volumeAttributes -> bucketName`
- Bucket region (if bucket and cluster are in different regions): `PersistentVolume -> csi -> mountOptions`
- [Mountpoint configurations](https://github.com/awslabs/mountpoint-s3/blob/main/doc/CONFIGURATION.md) can be added in the `mountOptions` of the Persistent Volume spec.
Expand Down
57 changes: 57 additions & 0 deletions examples/kubernetes/static_provisioning/s3_express_specify_az.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: s3-pv
spec:
capacity:
storage: 1200Gi # ignored, required
accessModes:
- ReadWriteMany # supported options: ReadWriteMany / ReadOnlyMany
mountOptions:
- allow-delete
- region us-west-2
csi:
driver: s3.csi.aws.com # required
volumeHandle: s3-csi-driver-volume
volumeAttributes:
bucketName: s3-csi-driver--usw2-az1--x-s3
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: s3-claim
spec:
accessModes:
- ReadWriteMany # supported options: ReadWriteMany / ReadOnlyMany
storageClassName: "" # required for static provisioning
resources:
requests:
storage: 1200Gi # ignored, required
volumeName: s3-pv
---
apiVersion: v1
kind: Pod
metadata:
name: s3-app
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- us-west-2a # specify az where bucket lives, note: the code of the availability zone (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) must be used here (the AZ ID won't work)
containers:
- name: app
image: centos
command: ["/bin/sh"]
args: ["-c", "echo 'Hello from the container!' >> /data/$(date -u).txt; tail -f /dev/null"]
volumeMounts:
- name: persistent-storage
mountPath: /data
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: s3-claim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
- ReadWriteMany # supported options: ReadWriteMany / ReadOnlyMany
mountOptions:
- allow-delete
- region eu-west-1
- region us-west-2
csi:
driver: s3.csi.aws.com # required
volumeHandle: s3-csi-driver-volume
Expand Down

0 comments on commit ab48c45

Please sign in to comment.