emptyDir
What is emptyDir?
emptyDir: A scratch volume created empty when a Pod starts and deleted when the Pod is removed. Good for caches and sharing files between containers in one Pod. An emptyDir is a temporary volume in Kubernetes. It is created empty when a pod starts and deleted when the pod is removed.
Frequently asked questions about emptyDir
How is emptyDir used in practice?
All containers in the same pod can use it, which makes it useful for sharing files between them, such as a sidecar that processes logs written by the main container. It also works as scratch space for caches, temporary uploads or build output.
What should you keep in mind with emptyDir?
Never store data you need to keep in an emptyDir. A pod can be rescheduled to another node at any time, and the volume goes with it. Set a sizeLimit so a runaway cache cannot fill the node's disk. For a faster cache in memory, medium: Memory uses RAM instead, which counts towards the container's memory limit.
What does an example of emptyDir look like?
volumes: - name: tmp emptyDir: sizeLimit: 500Mi At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |