RAM-backed emptyDir (tmpfs)¶
RAM-backed emptyDir is a configuration of the Kubernetes emptyDir volume that uses the node's RAM (memory) as the storage medium, backed by a tmpfs filesystem^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
Configuration¶
This functionality is defined within the spec.volumes.emptyDir field of a Pod manifest^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md]. To enable RAM-backed storage, the medium field must be set to Memory^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
A sizeLimit is recommended when using this medium to constrain the amount of memory consumed^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
spec:
volumes:
- name: cache-volume
emptyDir:
medium: Memory
sizeLimit: 256Mi
Characteristics¶
- Performance: Because the data is stored in memory, this storage type offers very high performance^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
- Capacity: The available space is limited by the system's memory resources^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
- Lifetime: Like standard
emptyDir, the volume's lifecycle is tied to the Pod; it is created when the Pod is started and deleted when the Pod is removed^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
Use Cases¶
Due to its high speed and volatility, this configuration is typically used to provide cache space for applications^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md].
Related Concepts¶
- [[Kubernetes Volumes]]
- [[Pods]]
- [[emptyDir]]
Sources¶
^[400-devops__06-Kubernetes__k8s-ithelp__Day17__README.md]