25.5. Upgrading the Cluster Operator
Use the same method to upgrade the Cluster Operator as the initial method of deployment.
This procedure describes how to upgrade a Cluster Operator deployment to use Streams for Apache Kafka 2.7.
Follow this procedure if you deployed the Cluster Operator using the installation YAML files.
The availability of Kafka clusters managed by the Cluster Operator is not affected by the upgrade operation.
Refer to the documentation supporting a specific version of Streams for Apache Kafka for information on how to upgrade to that version.
Prerequisites
- An existing Cluster Operator deployment is available.
- You have downloaded the release artifacts for Streams for Apache Kafka 2.7.
Procedure
-
Take note of any configuration changes made to the existing Cluster Operator resources (in the
/install/cluster-operatordirectory). Any changes will be overwritten by the new version of the Cluster Operator. - Update your custom resources to reflect the supported configuration options available for Streams for Apache Kafka version 2.7.
Update the Cluster Operator.
Modify the installation files for the new Cluster Operator version according to the namespace the Cluster Operator is running in.
On Linux, use:
sed -i 's/namespace: .*/namespace: my-cluster-operator-namespace/' install/cluster-operator/*RoleBinding*.yamlOn MacOS, use:
sed -i '' 's/namespace: .*/namespace: my-cluster-operator-namespace/' install/cluster-operator/*RoleBinding*.yaml-
If you modified one or more environment variables in your existing Cluster Operator
Deployment, edit theinstall/cluster-operator/060-Deployment-strimzi-cluster-operator.yamlfile to use those environment variables.
When you have an updated configuration, deploy it along with the rest of the installation resources:
oc replace -f install/cluster-operatorWait for the rolling updates to complete.
If the new Operator version no longer supports the Kafka version you are upgrading from, the Cluster Operator returns an error message to say the version is not supported. Otherwise, no error message is returned.
If the error message is returned, upgrade to a Kafka version that is supported by the new Cluster Operator version:
-
Edit the
Kafkacustom resource. -
Change the
spec.kafka.versionproperty to a supported Kafka version.
-
Edit the
- If the error message is not returned, go to the next step. You will upgrade the Kafka version later.
Get the image for the Kafka pod to ensure the upgrade was successful:
oc get pods my-cluster-kafka-0 -o jsonpath='{.spec.containers[0].image}'The image tag shows the new Streams for Apache Kafka version followed by the Kafka version:
registry.redhat.io/amq-streams/strimzi-kafka-37-rhel9:2.7.0You can also check the upgrade has completed successfully from the status of the
Kafkaresource.
The Cluster Operator is upgraded to version 2.7, but the version of Kafka running in the cluster it manages is unchanged.
If you deployed Streams for Apache Kafka from OperatorHub, use the Operator Lifecycle Manager (OLM) to change the update channel for the Streams for Apache Kafka operators to a new Streams for Apache Kafka version.
Updating the channel starts one of the following types of upgrade, depending on your chosen upgrade strategy:
- An automatic upgrade is initiated
- A manual upgrade that requires approval before installation begins
If you subscribe to the stable channel, you can get automatic updates without changing channels. However, enabling automatic updates is not recommended because of the potential for missing any pre-installation upgrade steps. Use automatic upgrades only on version-specific channels.
For more information on using OperatorHub to upgrade Operators, see the Upgrading installed Operators (OpenShift documentation).
25.5.3. Migrating to unidirectional topic management 复制链接链接已复制到粘贴板!
When deploying the Topic Operator to manage topics, the Cluster Operator enables unidirectional topic management by default. If you are switching from a version of Streams for Apache Kafka that used bidirectional topic management, there are some cleanup tasks to perform after upgrading the Cluster Operator. For more information, see 第 10.9 节 “Switching between Topic Operator modes”.
If you upgrade the Cluster Operator to a version that does not support the current version of Kafka you are using, you get an unsupported Kafka version error. This error applies to all installation methods and means that you must upgrade Kafka to a supported Kafka version. Change the spec.kafka.version in the Kafka resource to the supported version.
You can use oc to check for error messages like this in the status of the Kafka resource.
Checking the Kafka status for errors
oc get kafka <kafka_cluster_name> -n <namespace> -o jsonpath='{.status.conditions}'
Replace <kafka_cluster_name> with the name of your Kafka cluster and <namespace> with the OpenShift namespace where the pod is running.
Action required if upgrading from Streams for Apache Kafka 1.7 or earlier using the OperatorHub
Before you upgrade the Streams for Apache Kafka Operator to version 2.7, you need to make the following changes:
-
Convert custom resources and CRDs to
v1beta2 -
Upgrade to a version of Streams for Apache Kafka where the
ControlPlaneListenerfeature gate is disabled
These requirements are described in 第 25.2.2 节 “Upgrading from a Streams for Apache Kafka version earlier than 1.7”.
If you are upgrading from Streams for Apache Kafka 1.7 or earlier, do the following:
- Upgrade to Streams for Apache Kafka 1.7.
- Download the Red Hat Streams for Apache Kafka API Conversion Tool provided with Streams for Apache Kafka 1.8 from the Streams for Apache Kafka software downloads page.
Convert custom resources and CRDs to
v1beta2.For more information, see the Streams for Apache Kafka 1.7 upgrade documentation.
- In the OperatorHub, delete version 1.7 of the Streams for Apache Kafka Operator.
If it also exists, delete version 2.7 of the Streams for Apache Kafka Operator.
If it does not exist, go to the next step.
If the Approval Strategy for the Streams for Apache Kafka Operator was set to Automatic, version 2.7 of the operator might already exist in your cluster. If you did not convert custom resources and CRDs to the
v1beta2API version before release, the operator-managed custom resources and CRDs will be using the old API version. As a result, the 2.7 Operator is stuck in Pending status. In this situation, you need to delete version 2.7 of the Streams for Apache Kafka Operator as well as version 1.7.If you delete both operators, reconciliations are paused until the new operator version is installed. Follow the next steps immediately so that any changes to custom resources are not delayed.
In the OperatorHub, do one of the following:
-
Upgrade to version 1.8 of the Streams for Apache Kafka Operator (where the
ControlPlaneListenerfeature gate is disabled by default). -
Upgrade to version 2.0 or 2.2 of the Streams for Apache Kafka Operator (where the
ControlPlaneListenerfeature gate is enabled by default) with theControlPlaneListenerfeature gate disabled.
-
Upgrade to version 1.8 of the Streams for Apache Kafka Operator (where the
Upgrade to version 2.7 of the Streams for Apache Kafka Operator immediately.
The installed 2.7 operator begins to watch the cluster and performs rolling updates. You might notice a temporary decrease in cluster performance during this process.