// This module is included in the following assemblies:
//
// assembly-upgrade.adoc

[id='proc-upgrading-the-co-{context}']
= Upgrading the Cluster Operator to a later version

This procedure describes how to upgrade a Cluster Operator deployment to a later version.

.Prerequisites

* An existing Cluster Operator deployment is available.
* You have xref:downloads-{context}[downloaded the installation files for the new version].

.Procedure

. Take note of any configuration changes made to the existing Cluster Operator resources (in the `/install/cluster-operator` directory).
Any changes will be *overwritten* by the new version of the Cluster Operator.

. Update the Cluster Operator.

.. Modify the installation files for the new version according to the namespace the Cluster Operator is running in.
+
include::snip-cluster-operator-namespace-sed.adoc[]
+
.. If you modified one or more environment variables in your existing Cluster Operator `Deployment`, edit the
`install/cluster-operator/050-Deployment-cluster-operator.yaml` file to use those environment variables.

. When you have an updated configuration, deploy it along with the rest of the installation resources:
+
[source,shell,subs="+quotes,attributes"]
----
kubectl apply -f install/cluster-operator
----
+
Wait for the rolling updates to complete.

. Get the image for the Kafka pod to ensure the upgrade was successful:
+
[source,shell,subs="+quotes,attributes"]
----
kubectl get po my-cluster-kafka-0 -o jsonpath='{.spec.containers[0].image}'
----
+
The image tag shows the new {ProductName} version followed by the Kafka version. For example, `_<New {ProductName} version>_-kafka-_<Current Kafka version>_`.

. Update existing resources to handle deprecated custom resource properties.
+
* xref:assembly-upgrade-resources-{context}[{ProductName} resource upgrades]

You now have an updated Cluster Operator, but the version of Kafka running in the cluster it manages is unchanged.

.What to do next

Following the Cluster Operator upgrade, you can perform a xref:assembly-upgrading-kafka-versions-str[Kafka upgrade].
