This example shows how to make a static provisioned Mountpoint for S3 persistent volume (PV) mounted inside container.
static_provisioning.yaml
- spawning a pod which creates a file with name as the current date/timenon_root.yaml
- same as above, but the pod is spawned as non-root (uid1000
, gid2000
)s3_express_specify_az.yaml
- same as above, but this uses a S3 Express One Zone directory bucket and shows how to specify the availability zone (AZ) of the persistent volume to co-locate the pods with the bucket for lower latency accessmultiple_buckets_one_pod.yaml
- same as above, with multiple buckets mounted in one pod. Note: when mounting multiple buckets in the same pod, thevolumeHandle
must be unique as specified in the CSI documentation.multiple_pods_one_pv.yaml
- same as above, with multiple pods mounting the same persistent volume, in Deployment kind, that can be used to scale pods, using HPA or other method to create more replicascaching.yaml
- shows how to configure mountpoint to use a cache directory. See the Mountpoint documentation for more details on caching options. Please thumbs up #11 or add deatils about your use case if you want improvements in this area.kms_sse.yaml
- demonstrates using SSE-KMS encryption with a customer supplied key id. See the Mountpoint documentation for more details.aws_max_attempts.yaml
- configure the number of retries for requests to S3. This option is passed to Mountpoint as theAWS_MAX_ATTEMPTS
environment variable. See the Mountpoint configuration documentation for more details.
Edit Persistent Volume
Note: This example assumes your S3 bucket has already been created. If you need to create a bucket, follow the S3 documentation for a general purpose bucket or the S3 Express One Zone documentation 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 can be added in the
mountOptions
of the Persistent Volume spec.
See Static Provisioning configuration page for more details.
kubectl apply -f examples/kubernetes/static_provisioning/static_provisioning.yaml
kubectl get pod s3-app
$ aws s3 ls <bucket_name>
> 2023-09-18 17:36:17 26 Mon Sep 18 17:36:14 UTC 2023.txt
kubectl delete -f examples/kubernetes/static_provisioning/static_provisioning.yaml