Skip to content

Latest commit

 

History

History

static_provisioning

Static Provisioning Example

This example shows how to make a static provisioned Mountpoint for S3 persistent volume (PV) mounted inside container.

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 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 access
  • multiple_buckets_one_pod.yaml - same as above, with multiple buckets mounted in one pod. Note: when mounting multiple buckets in the same pod, the volumeHandle 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 replicas
  • caching.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 the AWS_MAX_ATTEMPTS environment variable. See the Mountpoint configuration documentation for more details.

Configure

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.

Deploy

kubectl apply -f examples/kubernetes/static_provisioning/static_provisioning.yaml

Check the pod is running

kubectl get pod s3-app

[Optional] Check fc-app created a file in s3

$ aws s3 ls <bucket_name>
> 2023-09-18 17:36:17         26 Mon Sep 18 17:36:14 UTC 2023.txt

Cleanup

kubectl delete -f examples/kubernetes/static_provisioning/static_provisioning.yaml