// Module included in the following assemblies:
//
// assembly-storage.adoc

[id='ref-ephemeral-storage-{context}']
= Ephemeral storage

[role="_abstract"]
Ephemeral data storage is transient. 
All pods on a node share a local ephemeral storage space. 
Data is retained for as long as the pod that uses it is running.
The data is lost when a pod is deleted. 
Although a pod can recover data in a highly available environment.  

Because of its transient nature, ephemeral storage is only recommended for development and testing.

Ephemeral storage uses `{K8sEmptyDir}` volumes to store data.
An `emptyDir` volume is created when a pod is assigned to a node. 
You can set the total amount of storage for the `emptyDir` using the `sizeLimit` property .

IMPORTANT: Ephemeral storage is not suitable for single-node ZooKeeper clusters or Kafka topics with a replication factor of 1.

To use ephemeral storage, you set the storage type configuration in the `Kafka` or `ZooKeeper` resource to `ephemeral`.

.Example ephemeral storage configuration
[source,yaml,subs="attributes+"]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    storage:
      type: ephemeral
    # ...
  zookeeper:
    # ...
    storage:
      type: ephemeral
    # ...
----

== Mount path of Kafka log directories

The ephemeral volume is used by Kafka brokers as log directories mounted into the following path:

[source,shell,subs="+quotes,attributes"]
----
/var/lib/kafka/data/kafka-log__IDX__
----

Where `_IDX_` is the Kafka broker pod index. For example `/var/lib/kafka/data/kafka-log0`.
