// Module included in the following assemblies:
//
// managing/assembly-rolling-updates.adoc

[id='proc-manual-rolling-update-pods-{context}']
= Performing a rolling update using a pod annotation

This procedure describes how to manually trigger a rolling update of existing Kafka, Kafka Connect, or MirrorMaker 2 clusters using a Kubernetes `Pod` annotation.
When multiple pods are annotated, consecutive rolling updates are performed within the same reconciliation run.

.Prerequisites

To perform a manual rolling update, you need a running Cluster Operator.
The cluster for the component you are updating, whether it's Kafka, Kafka Connect, or MirrorMaker 2, must also be running.

You can perform a rolling update on a Kafka cluster regardless of the topic replication factor used.
But for Kafka to stay operational during the update, you'll need the following:

* A highly available Kafka cluster deployment running with nodes that you wish to update.
* Topics replicated for high availability.
+
Topic configuration specifies a replication factor of at least 3 and a minimum number of in-sync replicas to 1 less than the replication factor.
+
.Kafka topic replicated for high availability
[source,yaml,subs="attributes+"]
----
apiVersion: {KafkaTopicApiVersion}
kind: KafkaTopic
metadata:
  name: my-topic
  labels:
    strimzi.io/cluster: my-cluster
spec:
  partitions: 1
  replicas: 3
  config:
    # ...
    min.insync.replicas: 2
    # ...
----

.Procedure

. Find the name of the `Pod` you want to manually update.
+
Pod naming conventions are as follows:
+
--
* `<cluster_name>-kafka-<index_number>` for a Kafka cluster
* `<cluster_name>-connect-<index_number>` for a Kafka Connect cluster
* `<cluster_name>-mirrormaker2-<index_number>` for a MirrorMaker 2 cluster
--
+
The `<index_number>` assigned to a pod starts at zero and ends at the total number of replicas minus one.

. Use `kubectl annotate` to annotate the `Pod` resource in Kubernetes:
+
[source,shell,subs=+quotes]
----
kubectl annotate pod <cluster_name>-kafka-<index_number> strimzi.io/manual-rolling-update="true"

kubectl annotate pod <cluster_name>-connect-<index_number> strimzi.io/manual-rolling-update="true"

kubectl annotate pod <cluster_name>-mirrormaker2-<index_number> strimzi.io/manual-rolling-update="true"
----

. Wait for the next reconciliation to occur (every two minutes by default).
A rolling update of the annotated `Pod` is triggered, as long as the annotation was detected by the reconciliation process.
When the rolling update of a pod is complete, the annotation is automatically removed from the `Pod`.

NOTE: Unless the `ContinueReconciliationOnManualRollingUpdateFailure` feature gate is disabled, reconciliation continues even if the manual rolling update of the cluster fails.
This allows the Cluster Operator to recover from certain rectifiable situations that can be addressed later in the reconciliation. 
For example, it can recreate a missing Persistent Volume Claim (PVC) or Persistent Volume (PV) that caused the update to fail.