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

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

Ephemeral storage uses the `{K8sEmptyDir}` volumes to store data.
To use ephemeral storage, the `type` field should be set to `ephemeral`.

IMPORTANT: `emptyDir` volumes are not persistent and the data stored in them will be lost when the Pod is restarted.
After the new pod is started, it has to recover all data from other nodes of the cluster.
Ephemeral storage is not suitable for use with single node ZooKeeper clusters and for Kafka topics with replication factor 1, because it will lead to data loss.

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

== Log directories

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

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