Persistent Volumes vs. Object Storage: When to Use Each
A persistent volume is a disk your pod mounts, a bucket is where your app sends whole files over HTTPS. How they differ in access, sharing, durability and cost, which data belongs on each, the mistakes to avoid, and how to move files from a volume to a bucket.

On this page
Key takeaways
- A persistent volume is a disk mounted into a pod: full filesystem semantics and low latency, but sized up front and attached to one node unless it is ReadWriteMany.
- Object storage keeps whole files behind an HTTPS API: any number of apps, clusters, scripts and browsers can use it at once, and it grows with the data.
- Databases, queues and search indexes belong on ReadWriteOnce volumes or a managed database, never on a bucket mounted as a filesystem.
- Uploads, media, backups, exports and static assets belong in a bucket, not on a ReadWriteOnce volume that pins the app to one replica.
- A volume's replicas are not a backup, and the volume lives and dies with its cluster: copy what matters to a versioned bucket.
- On Cloider a volume costs $0.50 per GiB provisioned per month and a bucket $0.10 per GB stored, with free requests and traffic.
Every application that outlives its first container has to keep data somewhere. On Kubernetes, and on most cloud platforms, there are two places for it that look interchangeable at first: a persistent volume, which gives a pod a disk, and object storage, which gives your app a bucket. Both keep data after the container is gone, both are replicated, and both cost cents per gigabyte.
They are not interchangeable. A database on a bucket mounted as a filesystem loses data or crawls. User uploads on a ReadWriteOnce volume pin the app to a single replica and turn every deploy into a short outage. Many of the storage problems teams run into come from putting data on the wrong one.
This article explains how persistent volumes and object storage work, how they differ in access, sharing, durability and cost, which kinds of data belong on each, and how to move files that ended up in the wrong place. The examples use Cloider Kubernetes and Object Storage, but the reasoning holds for any Kubernetes cluster and any S3 compatible storage.
The short answer
Use a persistent volume when software needs a filesystem: it opens files, writes into the middle of them, calls fsync and takes locks. Databases, queues and search indexes work this way.
Use object storage when your application stores whole files that are written once and read many times, often by more than one reader: uploads, media, generated documents, backups, logs and static assets.
If you are unsure, ask who needs the data. One process on one machine: a volume. Several replicas, several apps, a CI job or a user's browser: a bucket.
What a persistent volume is
A persistent volume is a disk that Kubernetes attaches to the node your pod runs on and mounts into the container at a path, such as /var/lib/postgresql/data. To your software it is an ordinary directory, and everything a filesystem offers works: reading and writing any byte range, appending, renaming a file in one atomic step, fsync to know a write reached the disk, and file locks.
You get one by creating a PersistentVolumeClaim, which asks for a size, an access mode and a storage class. The cluster provisions a volume and binds it to the claim:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: search-data
namespace: shop
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: cloider-standard
resources:
requests:
storage: 20GiThree properties shape everything else about volumes:
They have a fixed size. You choose the capacity up front and pay for all of it, full or not. A volume can grow, but Kubernetes never shrinks one.
They are attached, not shared. The common access mode,
ReadWriteOnce, lets pods on one node at a time mount the volume.ReadWriteManyvolumes can be mounted on many nodes at once, but they are network filesystems with tradeoffs of their own, covered below.They live inside the cluster. A volume belongs to its claim and its cluster. Delete the claim, with the usual
Deletereclaim policy, and the data is gone. On Cloider, deleting a cluster deletes every volume in it too.
Every Cloider cluster has two storage classes: cloider-standard, the default, for ReadWriteOnce volumes, and cloider-standard-rwx for ReadWriteMany. Both keep each volume in three replicas and can grow in place. See Persistent volumes in the docs.
What object storage is
Object storage keeps files as objects in a bucket, and you reach it over HTTPS with the S3 API instead of mounting it. An object is a whole file plus some metadata, stored under a key such as invoices/2026/12/INV-1042.pdf. The operations are few and coarse: put an object, get an object or a byte range of one, list keys by prefix, delete an object.
What object storage leaves out matters as much as what it offers:
No partial writes. To change one byte you upload the whole object again. There is no append and no writing into the middle of a file.
No rename. Moving an object is a copy and a delete. Renaming a "folder" means copying every object in it.
No locks and no fsync. A PUT either completes and the new object is there, or it fails and the old one is untouched. Two writers to the same key race, and the last one wins.
Every operation is a network request, usually tens of milliseconds rather than the fraction of a millisecond a local disk takes.
In return you get storage that nobody has to size, that any number of clients can use at once from anywhere with a network connection and a key, and that lives on its own, outside any cluster or app. Public files get a plain URL and private ones a short lived presigned URL, so browsers download them straight from the bucket. Cloider Object Storage adds versioning, lifecycle rules, bucket policies, CORS and static website hosting, and bills only for the data stored.
Persistent volumes vs. object storage at a glance
Persistent volume | Object storage | |
|---|---|---|
How you use it | Mounted at a path, read and written as files | HTTPS requests with the S3 API |
Unit of change | Any byte range of a file | A whole object |
Who can use it | Pods on one node (ReadWriteOnce) or in one cluster (ReadWriteMany) | Any app, cluster, script, CI job or browser with a key or a URL |
Latency | Under a millisecond to a few milliseconds | An HTTPS round trip per request, usually tens of milliseconds |
Size | Chosen up front, grows when you resize it, never shrinks | Grows and shrinks with the data |
Price on Cloider | $0.50 per GiB provisioned per month | $0.10 per GB stored per month, requests and traffic free |
Guarantees | Filesystem semantics: fsync, locks, atomic rename | Each PUT is atomic, the last writer wins, no locks |
Serving files to users | Through your app | Directly, by public or presigned URL |
Protection | Replicas against disk failure, backups are up to you | Versioning, lifecycle rules, scoped keys and policies |
Lifetime | Deleted with its claim or its cluster | Independent of any app or cluster |
Made for | Databases, queues, indexes, software that needs a filesystem | Uploads, media, backups, exports, logs, static assets |
When to use a persistent volume
Pick a volume when the software that writes the data needs a real filesystem, and one process, or one replica of a StatefulSet, owns each volume:
Databases. PostgreSQL, MySQL and MongoDB rewrite pages in place, append to a write ahead log and rely on
fsyncto know a transaction is safe. None of that maps to whole objects.Message queues and streams. RabbitMQ, Kafka and NATS JetStream append to segment files all day.
Search indexes and time series databases. Elasticsearch, OpenSearch, Meilisearch and Prometheus merge and compact files constantly and want low latency for it.
Software you can't change that only knows how to write to a directory: a CMS's plugin folder, a Git server's repositories, a CI server's home directory.
Large scratch space for one job that doesn't fit on the container's own disk, such as a working directory for transcoding video, as long as the result goes somewhere durable afterwards.
When such software runs several replicas, give each its own volume with a StatefulSet's volumeClaimTemplates, so replica 0 always gets data-0, rather than sharing one.
Before you run a database on a volume yourself, consider whether you need to. A PostgreSQL in a StatefulSet makes backups, upgrades, failover and restores your job. A managed database gives you the same engine with those handled: Cloider's managed databases can be restored to any second of the last 14 days, and your pods connect to them like any other client.
When to use object storage
Pick a bucket when files are written as a whole, read many times, and needed by more than one reader:
User uploads and media: avatars, attachments, images, video. Every replica of your app sees the same files, and browsers download them straight from the bucket.
Generated files: invoices, reports, exports, thumbnails. A lifecycle rule can delete the temporary ones after a week.
Backups and database dumps: off the cluster, versioned, and still there when the cluster isn't.
Static assets and static websites: a bucket can serve a whole site on its own address or on your domain.
Logs, events and data files that only grow, archived as compressed files per hour or per day and read by whatever analyses them.
Build artifacts, release binaries, model weights, datasets and Terraform state: anything a CI job, another cluster or a teammate's laptop also needs.
The price of a bucket is paid in code: your app calls the S3 API instead of writing to a path. Every language has an SDK for it, and most frameworks already have an S3 driver, such as Laravel's filesystem disks, django-storages and Rails' Active Storage. Why your application should never store files locally walks through that change with code.
What about ReadWriteMany volumes?
A ReadWriteMany volume looks like the best of both: a filesystem that every replica mounts at once. Sometimes it is the right tool, but know what you are buying.
It is a network filesystem. Every file operation crosses the network, and metadata operations, such as listing a directory of 100,000 files or creating many small ones, are much slower than on a local disk. Locks between machines are where network filesystems are weakest, so SQLite and other software that relies on file locks to coordinate writers doesn't belong on one. For databases, use a ReadWriteOnce volume.
It also keeps the other limits of a volume. It lives in one cluster, so another cluster or an app outside it can't reach the files. It has no versioning, so a bad deploy that deletes a folder deletes it for good. You pay for its provisioned size at the volume rate. And your app still serves every file to users itself.
Use ReadWriteMany when software needs a shared directory and can't be changed to use S3, such as several replicas of a WordPress site sharing wp-content. For anything your own code writes, a bucket is the better shared store.
Five mistakes to avoid
Mounting a bucket as a filesystem for a database. FUSE tools such as s3fs make a bucket look like a directory. That is fine for reading large files. It is not fine for software that writes in place: changing a few bytes uploads the whole object again, renames turn into copies, there are no real locks, and fsync doesn't mean what the database thinks it means. Databases on mounted buckets lose data or crawl.
User uploads on a ReadWriteOnce volume. The volume attaches to one node, so the app runs as one replica. Every deploy has to stop the old pod before the new one can mount the volume, the Recreate strategy, which is downtime, and a rolling update ends in a Multi-Attach error instead. A StatefulSet with a volume per replica is worse: each replica ends up with a different set of files.
Treating a volume's replicas as a backup. Replicas protect against a failed disk or node. They copy a mistaken rm -rf, a bad migration or ransomware just as faithfully. A backup is a copy somewhere else, from a point in time. Cloider has no snapshots for the volumes in your cluster, so dump and copy what matters to a bucket on a schedule, with versioning on. Back up a database to a bucket shows the pattern as a CronJob.
Oversizing volumes "just in case". You pay for provisioned capacity, not for what is used, and a claim can't shrink. Size volumes for what you need now and grow them when you need more. Look for claims nobody uses too: uninstalled Helm releases and scaled down StatefulSets leave theirs behind, and they keep costing money.
Keeping data on a volume that has to outlive the cluster. A volume can't be mounted from another cluster, and deleting a Cloider cluster deletes its volumes. Anything you would want after recreating the cluster, or in another one, such as uploads, exports and backups, belongs in a bucket from the start.
What it costs
Volumes and buckets are priced on different things, and the difference adds up. On Cloider, at the time of writing, a volume costs $0.50 per GiB of provisioned capacity per month, and a bucket $0.10 per GB stored per month, with no charges for requests or traffic.
Take 50 GB of user uploads that grow by a few GB a month:
On a volume you provision headroom, say 100 GiB, and pay for all of it: $50 a month, however much is in it.
In a bucket you pay for the 50 GB stored: $5 a month, rising only as the files do.
The bucket also takes serving off your app. Downloads go from the bucket to the browser, so your replicas spend their CPU on requests rather than on streaming bytes.
For a database the question runs the other way: the data needs a filesystem, so you choose between a volume you run yourself and a managed database whose plan includes its storage. Current prices are on the pricing page and in cloider pricing.
Moving files from a volume to a bucket
If uploads already live on a volume in your cluster, a one-off Job can copy them to a bucket. Create a bucket and an access key for it in the dashboard, or with cloider bucket create and cloider bucket key create, and store the key in a Secret:
kubectl create secret generic uploads-bucket -n shop \
--from-literal=AWS_ACCESS_KEY_ID=CLDR... \
--from-literal=AWS_SECRET_ACCESS_KEY="$S3_SECRET_KEY" \
--from-literal=AWS_REGION=eu-central-2 \
--from-literal=AWS_ENDPOINT_URL_S3=https://s3.eu-central-2.cloider.com \
--from-literal=AWS_REQUEST_CHECKSUM_CALCULATION=when_required \
--from-literal=AWS_RESPONSE_CHECKSUM_VALIDATION=when_requiredThe two checksum settings are needed because recent AWS tools add a checksum to every upload by default, which Cloider's storage doesn't accept. Then define a Job that mounts the claim read-only and syncs it to the bucket:
apiVersion: batch/v1
kind: Job
metadata:
name: uploads-to-bucket
namespace: shop
spec:
backoffLimit: 1
template:
spec:
restartPolicy: Never
containers:
- name: sync
image: amazon/aws-cli:2.43.3
args: ["s3", "sync", "/uploads", "s3://acme-uploads/uploads/"]
envFrom:
- secretRef:
name: uploads-bucket
volumeMounts:
- name: uploads
mountPath: /uploads
readOnly: true
volumes:
- name: uploads
persistentVolumeClaim:
claimName: uploadsA ReadWriteOnce volume can only be mounted on one node at a time, so free it first. Scale the app down, run the Job, and wait for it:
kubectl scale deployment web -n shop --replicas=0
kubectl apply -f uploads-to-bucket.yaml
kubectl wait --for=condition=complete job/uploads-to-bucket -n shop --timeout=30m
kubectl logs job/uploads-to-bucket -n shop | tail -n 3Then deploy the version of your app that reads and writes the bucket and no longer mounts the volume. Store object keys such as uploads/42.jpg in your database rather than file paths. Keep the claim until you have checked that everything loads, then delete it with kubectl delete pvc uploads -n shop to stop paying for it.
With a ReadWriteMany volume there is no need to scale down: run the Job while the app is up, deploy the new version, then delete the finished Job and run it once more. aws s3 sync only copies what is missing or changed, so the second run just picks up files uploaded in between.
A rule of thumb
Does the software write into files, append,
fsyncor lock? A volume,ReadWriteOnce, or a managed database if it is one.Do several replicas, apps, clusters or browsers need the same files? A bucket.
Is each file written once and read many times? A bucket.
Must the data outlive the cluster? A bucket, or a managed database.
Is it only needed during one request or one job run? Neither: the container's own disk or an
emptyDir.Does third party software insist on a shared directory? A ReadWriteMany volume, backed up to a bucket.
Use both, each for its job
Most production systems use both. A typical setup on Cloider: the web app runs on App Engine, or as a Deployment with no state of its own, its records live in a managed PostgreSQL database, sessions and cache in Redis, and uploads, exports and backups in a bucket. Volumes hold the stateful pieces you choose to run yourself in a Kubernetes cluster, such as a search index or a queue, each owned by one pod and backed up to the bucket.
Cloider App Engine apps don't get volumes at all, on purpose: any replica can be replaced or added at any time, so their files go to a bucket and their records to a database.
Cloider Kubernetes gives your clusters persistent volumes in both access modes, billed per GiB, and Cloider Object Storage gives you S3 compatible buckets with versioning, lifecycle rules, presigned URLs and static websites, billed only for what you store. Start with Persistent volumes and Use buckets from apps and clusters, or create a free account and try both with the welcome credit.
Frequently asked questions
What is the difference between a persistent volume and object storage?
A persistent volume is a disk mounted into a pod at a path and used as files, with full filesystem semantics, a size chosen up front, and one node at a time unless it is ReadWriteMany. Object storage keeps whole files as objects in a bucket, reached over HTTPS with the S3 API by any number of clients, and grows with the data.
Can I run a database on object storage?
Not on a bucket mounted as a filesystem. Databases write into files in place and rely on fsync and locks, which object storage doesn't offer. Run a database on a ReadWriteOnce volume or use a managed database, and keep its backups in a bucket.
Should I store user uploads on a persistent volume or in S3?
In S3 compatible object storage. A ReadWriteOnce volume ties the app to one replica and makes every deploy stop the old pod first, while a bucket is shared by every replica, survives the cluster and serves files to browsers by URL.
Is a ReadWriteMany volume a good replacement for object storage?
Only for software that needs a shared directory and can't use S3. It is a network filesystem that is slow with many small files and weak at locking across nodes, it lives in one cluster, has no versioning and is billed per provisioned GiB.
Which is cheaper, a persistent volume or object storage?
Object storage, for files. On Cloider a volume costs $0.50 per GiB of provisioned capacity per month and a bucket $0.10 per GB stored per month, with free requests and traffic. A 100 GiB volume costs $50 a month however full it is, 50 GB in a bucket costs $5.
Are persistent volumes backed up on Cloider?
Each volume is kept in three replicas, which protects against a failed disk or node but not against deleted or corrupted data, and Cloider has no snapshots for cluster volumes. Copy the data that matters to a bucket on a schedule, with versioning on.
Do Cloider apps support persistent volumes?
No. Cloider App Engine apps get no disk that outlives a replica, so any replica can be replaced or added at any time. Store their files in a bucket and their data in a managed database. Persistent volumes are available in Cloider Kubernetes clusters.



Comments