Understanding What Ephemeral Storage is and the Different Types
FAQs
Which storage type is ephemeral?
By default, all storage used by a container is ephemeral. That is, it’ll get deleted if the container crashes and is restarted. Containers, by definition, are immutable, so their file systems cannot be changed while running. If we want to persist changes, we either need to define a non-ephemeral volume or store our data using some database. The MongoDB Kubernetes operator can be handy in this case.
How much is ephemeral storage in Kubernetes?
By default, all storage in Kubernetes is ephemeral. Only if we define volumes that are not ephemeral do we get persistent storage.
Is cloud storage ephemeral?
Cloud storage is not ephemeral. If we need to create files and store them, we can use a service that implements Elastic Block Storage like OpenEBS or any of the major EBS services in the cloud providers.
What is the difference between ephemeral storage and persistent storage?
Ephemeral storage is tied to the lifecycle of containers. When a container is stopped or restarted, all data in ephemeral storage is deleted and lost. Persistent storage, on the other hand, survives container restarts.
Are pods ephemeral?
Yes. Running pods (group of containers) are by default ephemeral. The idea is to run a service — let's say a web server using several containers. This way, we can scale requests and start more containers to handle the workload. If we create a cached file and it’s stored _inside_ a container, when that container stops (because a problem was found, etc.) what happens to those cached files? Restarting the container will create a new one that starts from zero, and moving those files (now gone) is impossible. So, pods have to be ephemeral to allow for simple restart in case of any problems so they continue serving (in this example, web pages). And the storage inside each container is also volatile if we don't configure a persistent volume.
Get started with Atlas today
Get started in seconds. Our free clusters come with 512 MB of storage so you can play around with sample data and get oriented with our platform.
GET STARTED WITH:
- 125+ regions worldwide
- Sample data sets
- Always-on authentication
- End-to-end encryption
- Command line tools