New to KubeDB? Please start here.
Etcd Vertical Scaling
This guide gives an overview of how the KubeDB Ops-manager operator updates the compute resources
(CPU and Memory) of the etcd container of an Etcd cluster.
Before You Begin
- You should be familiar with the following
KubeDBconcepts:
How Vertical Scaling Process Works
The vertical scaling process consists of the following steps:
At first, a user creates an
EtcdCustom Resource (CR).The
KubeDBProvisioner operator watches theEtcdCR.When the operator finds an
EtcdCR, it creates aPetSetand the related resources — Secrets, Services, RBAC, and the cluster-state ConfigMap.Then, in order to update the resources of the
Etcdcluster, the user creates anEtcdOpsRequestCR of typeVerticalScalingwith the desired resources.The
KubeDBOps-manager operator watches theEtcdOpsRequestCR.When it finds a
VerticalScalingEtcdOpsRequest, it pauses the referencedEtcdobject, so theKubeDBProvisioner operator does not reconcile it while the scaling is in progress.The Ops-manager operator patches the
PetSetpod template with the new resources, so any pod recreated from that point on — by this ops request or by a later failure — carries them.It also patches
spec.podTemplate.spec.containers[]on theEtcdobject, so the Provisioner operator re-renders exactly the same template once the database is resumed.It then actuates the change on the running pods, in the mode selected by
spec.verticalScaling.mode(see below).Finally, the Ops-manager operator resumes the
Etcdobject so that the Provisioner operator resumes its usual operations, and marks theEtcdOpsRequestSuccessful.
Vertical Scaling Modes
KubeDB actuates vertical scaling in one of two modes, selected through the
spec.verticalScaling.mode field of the EtcdOpsRequest:
Restart(default): The operator restarts the member pods so that they come back with the new CPU and Memory. The restart is leader-aware and sequential — this is the part that is specific to etcd:- The operator first resolves the current Raft leader through etcd’s
Status()RPC. - Every follower is evicted first, one at a time. After each eviction the operator waits for
the pod to become
Readyand for the cluster to report a healthy quorum again before it touches the next member. Without that gate, a second eviction in a 3-member cluster would take quorum down. - The leader is restarted last, and only after its leadership has been handed to another
voting member with etcd’s
MoveLeaderRPC. A deliberate leadership transfer is near instantaneous, whereas evicting the leader outright triggers an election, during which the whole cluster is unavailable for writes for an election timeout. - A single-member cluster has no one to hand leadership to, so it is simply restarted.
- The operator first resolves the current Raft leader through etcd’s
InPlace: The operator resizes the running containers using the Kubernetes in-place Pod resize (pods/resizesubresource) — no pod restart, no leadership change, and no Raft election risk at all. If a Node cannot accommodate the new request (the kubelet marks the resizeInfeasible), the operator automatically falls back to theRestartbehavior for those pods only, using the same leader-last ordering described above.
If spec.verticalScaling.mode is omitted, it defaults to Restart.
Note:
InPlacemode relies on the KubernetesInPlacePodVerticalScalingfeature gate, which is enabled by default from Kubernetes v1.33. On older clusters, or when the feature gate is disabled, useRestartmode.
Scalable Containers
spec.verticalScaling for etcd has no node-selection or topology sub-fields — etcd has exactly one
container role, so there is a single etcd entry:
| Field | Container | Notes |
|---|---|---|
spec.verticalScaling.etcd | etcd | The etcd member container. This is the field you normally want. |
spec.verticalScaling.exporter | exporter | Present for structural parity with other KubeDB databases only. |
Important: KubeDB does not deploy a metrics exporter sidecar for etcd — etcd serves its own Prometheus metrics natively on the metrics listener (port
2381), so there is nothing extra to resize.spec.verticalScaling.exporterexists in theEtcdOpsRequestAPI for structural parity with the other KubeDB databases, and setting it has no effect unless you have added a container literally namedexporteryourself throughspec.podTemplate. Do not rely on it.
In the next doc, we are going to
show a step-by-step guide on updating the resources of an Etcd cluster using the EtcdOpsRequest CRD.
































