Resizing Broker Volumes in Kubernetes
The disk space needed for our brokers depends on customers use-cases, especially in regards to use of QoS > 0 and retained messages, as well as message size. We can therefore not perfectly predict the necessary disk space, allowing for a situation in which existing volumes need to be resized.
This procedure can be used to increase the available disk space for broker volumes with as little service interruption as possible. Currently this means pod restarts, which result in the necessity for clients to reconnect.
This guide can be used for control-plane-broker by replacing any mention of broker with control-plane-broker.
This procedure depends on removing the StatefulSet. This leaves the broker cluster open to failures caused by cluster events or human error. Therefore this should be executed with great care and only in a stable cluster.
Prerequisites
kubectlaccess to the necessary installation and the current context namespace set to the target namespace (kubectl config set-context --current --namespace <target-namespace>).A
StorageClassthat supports volume resizing (kubectl get scand check thatALLOWVOLUMEEXPANSIONshowtruefor the StorageClass used for the volumes.
Instructions
Preparing the Broker Cluster
Make sure that you have a healthy broker cluster of at least two pods (
kubectl get sts brokershowsREADY 2/2or higher, but same number on both sides of the slash)If you only have a single broker, scale the StatefulSet to two:
kubectl scale sts broker --replicas 2Export the StatefulSet definition to a local file:
kubectl get sts broker -o yaml > broker.yamlResizing Volumes
Repeat this part for each broker cluster pod you have.
Delete the broker StatufulSet while leaving the pods as orphans:
kubectl delete sts broker --cascade=orphanSet variable
$brokerto the pod name of the broker you want to resize (e.g.broker-0):
broker=broker-0Delete the broker pod:
kubectl delete pod $brokerIncrease the PVC size (replace
sizewith the Kubernetes Quantity for the volume, e.g.5Gi):
kubectl patch pvc brokerdata-$broker --patch '{"spec": { "resources": {"requests": {"storage": "<size>"}}}}'Wait until the PVC shows the correct CAPACITY:
kubectl get pvc brokerdata-$brokerRecreate the StatefulSet:
kubectl apply -f broker.yamlWait for the StatefulSet to recreate the missing pod and wait for the StatefulSet to be ready (
kubectl get sts brokershowsREADY 2/2or higher, but same number on both sides of the slash)Verify that all cluster members show the same output for the cluster members:
kubectl get pod -lapp=broker -o name | xargs -I % kubectl exec % -- vmq-admin cluster showThe output should look similar to this:
Defaulted container "broker" out of: broker, wait-for-k8s (init)
+-------------------------------------------------+---------+
| Node | Running |
+-------------------------------------------------+---------+
| [email protected] | true |
+-------------------------------------------------+---------+
| [email protected] | true |
+-------------------------------------------------+---------+
Defaulted container "broker" out of: broker, wait-for-k8s (init)
+-------------------------------------------------+---------+
| Node | Running |
+-------------------------------------------------+---------+
| [email protected] | true |
+-------------------------------------------------+---------+
| [email protected] | true |
+-------------------------------------------------+---------+Repeat this step for the next broker, until all volumes are resized
Persisting through Helm values
Once you are done you should adjust your Helm values for Connectware to reflect the changes.
Update the following fields based on what volumes you resized:
brokerdata-broker-*
global.broker.storage.data.size
brokerlog-broker-*
global.broker.storage.log.size
brokerdata-control-plane-broker-*
global.controlPlaneBroker.storage.data.size
brokerlog-control-plane-broker-*
global.controlPlaneBroker.storage.log.size
Last updated
Was this helpful?

