Free — no signup required

Introduction: The Problem with Ephemeral Containers

1 min read

Containers Forget

By default, the filesystem inside a container is ephemeral — it exists only for the lifetime of that container process. Think of it like a whiteboard that gets erased every time someone leaves the room. If a container crashes and Kubernetes restarts it, any data written to that container's filesystem is gone. The new container starts with a completely blank slate.

The Need for Persistence

For stateless applications — like a web server that reads static files baked into its image — this is perfectly fine. But for stateful applications like databases (MySQL, PostgreSQL, MongoDB), message queues (Kafka), or any service that must remember user data across restarts, ephemeral storage is catastrophic. A database that loses all its records every time a Pod restarts is not a database — it's a very expensive /dev/null.

We need a way to store data outside the container's lifecycle so it survives restarts, crashes, rescheduling to different nodes, and even cluster upgrades. Kubernetes achieves this through a layered storage subsystem built around three core abstractions: PersistentVolumes, PersistentVolumeClaims, and StorageClasses.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free