Upgrade deployments
The KAAP Operator performs cluster upgrades in a very conservative manner, with the primary goal of reducing maintenance time during upgrades. Components are updated and then restarted only if strictly needed. For example, if only the broker needs to be upgraded, then all other services will be left up and running. If there is an error or interruption during upgrade, the operator will apply the desired state defined in the PulsarCluster custom resource until the resource matches the actual state.
If you’re upgrading from KAAP v0.1.0 to v0.2.0, you must upgrade the CRDs to v1beta1. See Upgrade to KAAP v0.2.0. |
The KAAP Operator follows a fixed schema to upgrade the cluster:
stateDiagram-v2
zk: Zookeeper Statefulset
zkinit: Zookeeper Metadata Initialization Job
bk: BookKeeper
broker: Broker
brokertxn: Broker Transactions Initialization Job
ar: Autorecovery
proxy: Proxy
ba: Bastion
fn: Functions Worker
[*] --> zk
zk --> zkinit : Ready
zkinit --> bk : Completed
bk --> broker : Ready
bk --> proxy : Ready
bk --> ba : Ready
bk --> ar : Ready
broker --> brokertxn : Ready
brokertxn --> fn : Completed
fn --> [*] : Ready
proxy --> [*] : Ready
ba --> [*] : Ready
ar --> [*] : Ready
Example
For example, if you’ve installed the operator and a Pulsar cluster with this yaml file:
-
Helm
-
Result
helm install pulsar helm/pulsar-operator -f helm/examples/bookie-autoscaling/values.yaml
NAME: pulsar
LAST DEPLOYED: Fri May 12 12:36:13 2023
NAMESPACE: pulsar-cluster
STATUS: deployed
REVISION: 1
TEST SUITE: None
-
While looking over your configuration, you decide you also need more brokers to handle requests. Edit the helm/examples/bookie-autoscaling/values.yaml file to change the number of Brokers from 1 to 3:
broker: replicas: 3 config: managedLedgerDefaultAckQuorum: 3 managedLedgerDefaultEnsembleSize: 3 managedLedgerDefaultWriteQuorum: 3 resources: requests: cpu: "0.1" memory: "128Mi"
-
Upgrade the cluster with the new values.yaml file:
-
Helm
-
Result
helm upgrade pulsar helm/pulsar-operator -f helm/examples/bookie-autoscaling/values.yaml
Release "pulsar" has been upgraded. Happy Helming! NAME: pulsar LAST DEPLOYED: Fri May 12 15:11:51 2023 NAMESPACE: pulsar-cluster STATUS: deployed REVISION: 5 TEST SUITE: None
-
-
The operator will upgrade the cluster to the new desired state. In this case, the operator adds two more broker pods, and touches nothing else.
-
Kubectl
-
Result
kubectl get pods -A
pulsar-cluster pulsar-autorecovery-57cfc8b84d-xvchb 1/1 Running 0 150m pulsar-cluster pulsar-bastion-74777cbbf9-pcq5x 1/1 Running 0 150m pulsar-cluster pulsar-bookkeeper-0 1/1 Running 0 152m pulsar-cluster pulsar-broker-0 1/1 Running 0 150m pulsar-cluster pulsar-broker-1 1/1 Running 0 8m9s pulsar-cluster pulsar-broker-2 1/1 Running 0 7m36s pulsar-cluster pulsar-operator-7d8cc69df5-ncs5j 1/1 Running 0 163m pulsar-cluster pulsar-proxy-5bd5cc4fb6-9pnl7 1/1 Running 0 150m pulsar-cluster pulsar-zookeeper-0 1/1 Running 0 155m pulsar-cluster pulsar-zookeeper-metadata-zgfn4 0/1 Completed 0 153m
-
-
You’ve successfully upgraded your deployment by just managing a single .yaml file. Thanks, KAAP Operator!
Upgrade CRDs
To upgrade CRDs:
-
Helm
-
Result
kubectl replace -f helm/pulsar-operator/crds
customresourcedefinition.apiextensions.k8s.io/autorecoveries.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/bastions.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/bookkeepers.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/brokers.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/functionsworkers.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/proxies.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/pulsarclusters.pulsar.oss.datastax.com replaced
customresourcedefinition.apiextensions.k8s.io/zookeepers.pulsar.oss.datastax.com replaced