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.
Upgrade schema
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
Upgrade example
For this example, assume you installed the operator and a Pulsar cluster with the following yaml file:
helm install pulsar helm/pulsar-operator -f helm/examples/bookie-autoscaling/values.yaml
Result
NAME: pulsar
LAST DEPLOYED: Fri May 12 12:36:13 2023
NAMESPACE: pulsar-cluster
STATUS: deployed
REVISION: 1
TEST SUITE: None
If you want to add more brokers to handle requests, edit helm/examples/bookie-autoscaling/values.yaml
to change the broker.replicas
and broker.config.managedLedgerDefault*
properties from 1
to 3
:
broker:
replicas: 3
config:
managedLedgerDefaultAckQuorum: 3
managedLedgerDefaultEnsembleSize: 3
managedLedgerDefaultWriteQuorum: 3
resources:
requests:
cpu: "0.1"
memory: "128Mi"
Then, upgrade the cluster with the new values.yaml
file:
helm upgrade pulsar helm/pulsar-operator -f helm/examples/bookie-autoscaling/values.yaml
Result
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 upgrades the cluster to the new desired state. In this case, the operator adds two more broker pods, and touches nothing else.
kubectl get pods -A
Result
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 changing only one YAML file.
Upgrade CRDs
To upgrade CRDs, run the following command:
kubectl replace -f helm/pulsar-operator/crds
Result
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