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

[id='proc-resizing-persistent-volumes-{context}']
= Resizing persistent volumes

[role="_abstract"]
You can provision increased storage capacity by increasing the size of the persistent volumes used by an existing Strimzi cluster.
Resizing persistent volumes is supported in clusters that use either a single persistent volume or multiple persistent volumes in a JBOD storage configuration.

NOTE: You can increase but not decrease the size of persistent volumes.
Decreasing the size of persistent volumes is not currently supported in Kubernetes.

.Prerequisites

* A Kubernetes cluster with support for volume resizing.
* The Cluster Operator is running.
* A Kafka cluster using persistent volumes created using a storage class that supports volume expansion.

.Procedure

. Edit the `Kafka` resource for your cluster.
+
Change the `size` property to increase the size of the persistent volume allocated to a Kafka cluster, a ZooKeeper cluster, or both.
+
--
* For Kafka clusters, update the `size` property under `spec.kafka.storage`.
* For ZooKeeper clusters, update the `size` property under `spec.zookeeper.storage`.
--
+
.Kafka configuration to increase the volume size to `2000Gi`
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    storage:
      type: persistent-claim
      size: 2000Gi
      class: my-storage-class
    # ...
  zookeeper:
    # ...
----

. Create or update the resource:
+
[source,shell,subs=+quotes]
kubectl apply -f _<kafka_configuration_file>_
+
Kubernetes increases the capacity of the selected persistent volumes in response to a request from the Cluster Operator.
When the resizing is complete, the Cluster Operator restarts all pods that use the resized persistent volumes.
This happens automatically.

. Verify that the storage capacity has increased for the relevant pods on the cluster:
+
[source,shell,subs=+quotes]
kubectl get pv
+
.Kafka broker pods with increased storage
[source,shell,subs="+quotes,attributes"]
----
NAME               CAPACITY   CLAIM
pvc-0ca459ce-...   2000Gi     my-project/data-my-cluster-kafka-2
pvc-6e1810be-...   2000Gi     my-project/data-my-cluster-kafka-0
pvc-82dc78c9-...   2000Gi     my-project/data-my-cluster-kafka-1
----
+
The output shows the names of each PVC associated with a broker pod.

[role="_additional-resources"]
.Additional resources

* For more information about resizing persistent volumes in Kubernetes, see {K8sResizingPersistentVolumesUsingKubernetes}.
