This guide explains how to decommission (take offline) specific Pods in Milvus clusters managed by KubeBlocks. Decommissioning provides precise control over cluster resources while maintaining availability. Use this for workload rebalancing, node maintenance, or addressing failures.
In traditional StatefulSet-based deployments, Kubernetes lacks the ability to decommission specific Pods. StatefulSets ensure the order and identity of Pods, and scaling down always removes the Pod with the highest ordinal number (e.g., scaling down from 3 replicas removes Pod-2
first). This limitation prevents precise control over which Pod to take offline, which can complicate maintenance, workload distribution, or failure handling.
KubeBlocks overcomes this limitation by enabling administrators to decommission specific Pods directly. This fine-grained control ensures high availability and allows better resource management without disrupting the entire cluster.
Before proceeding, ensure the following:
kubectl create ns demo
namespace/demo created
Please refer to Deploying a Milvus Cluster with KubeBlocks to deploy a milvus cluster.
Expected Workflow:
onlineInstancesToOffline
is removedUpdating
to Running
Before decommissioning a specific pod from a component, make sure this component has more than one replicas. If not, please scale out the componen ahead.
E.g. you can patch the cluster CR with command, to declare there are 3 replicas in component querynode.
kubectl patch cluster milvus-cluster -n demo --type='json' -p='[
{
"op": "replace",
"path": "/spec/componentSpecs/4/replicas",
"value": 3
}
]'
To decommission a specific Pod (e.g., 'milvus-cluster-querynode-1'), you can use one of the following methods:
Option 1: Using OpsRequest
Create an OpsRequest to mark the Pod as offline:
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: milvus-cluster-decommission-ops
namespace: demo
spec:
clusterName: milvus-cluster
type: HorizontalScaling
horizontalScaling:
- componentName: querynode
scaleIn:
onlineInstancesToOffline:
- 'milvus-cluster-querynode-1' # Specifies the instance names that need to be taken offline
Check the progress of the decommissioning operation:
kubectl get ops milvus-cluster-decommission-ops -n demo -w
Example Output:
NAME TYPE CLUSTER STATUS PROGRESS AGE
milvus-cluster-decommission-ops HorizontalScaling milvus-cluster Running 0/1 8s
milvus-cluster-decommission-ops HorizontalScaling milvus-cluster Running 1/1 31s
milvus-cluster-decommission-ops HorizontalScaling milvus-cluster Succeed 1/1 31s
Option 2: Using Cluster API
Alternatively, update the Cluster resource directly to decommission the Pod:
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
spec:
componentSpecs:
- name: milvus
replicas: 2 # explected replicas after decommission
offlineInstances:
- milvus-cluster-querynode-1 # <----- Specify Pod to be decommissioned
...
After applying the updated configuration, verify the remaining Pods in the cluster:
kubectl get pods -n demo -l app.kubernetes.io/instance=milvus-cluster
Example Output:
NAME READY STATUS RESTARTS AGE
milvus-cluster-querynode-0 2/2 Running 0 25m
milvus-cluster-querynode-2 2/2 Running 0 24m
Key takeaways:
This provides granular cluster management while maintaining availability.