PersistentVolumeClaim
container
services, tasks and tests can all mount volumes using this module type. To mount a volume, you need to define a volume module, and reference it using the volumes
key on your services, tasks and/or tests.
Example:
This will mount the my-volume
PVC at /volume
in the my-service
service when it is run. The my-volume
module creates a PersistentVolumeClaim
resource in your project namespace, and the spec
field is passed directly to the same field on the PVC resource.
Shared volumes
For a volume to be shared between multiple replicas, or multiple services, tasks and/or tests, it needs to be configured with a storage class (using the storageClassName
field) that supports the ReadWriteMany
(RWX) access mode. The available storage classes that support RWX vary by cloud providers and cluster setups, and in many cases you need to define a StorageClass
or deploy a storage class provisioner to your cluster.
Once any of those is set up you can create a persistentvolumeclaim
module that uses the configured storage class. Here, for example, is how you might use a shared volume with a configured azurefile
storage class:
Here the same volume is used across a service, task and a test in the same module. You could similarly use the same volume across multiple container modules.
Last updated
Was this helpful?