Scale Down Cluster
You can scale down the IOMesh cluster by removing chunk pods in the Kubernetes worker nodes.
Precautions
- You can only delete chunk pods. Deleting meta pods is not supported.
- You can only remove one chunk pod at a time.
- Each chunk pod is created sequentially and given a unique number by
StatefulSet, and you should remove them in reverse creation order. For example, if there are 5 chunk podsiomesh-chunk-0,iomesh-chunk-1,iomesh-chunk-2,iomesh-chunk-3,iomesh-chunk-4, deletion should start withiomesh-chunk-4.
Procedure
The following example reduces the number of chunk pods by removing iomesh-chunk-2 on the node k8s-worker-2.
Run the
ip acommand on thek8s-worker-2node to obtain the unique IP within the data CIDR. Assume the IP is192.168.29.23.Run the following command. Locate the
status.summary.chunkSummary.chunksfield and find the ID ofchunkswhose IP is192.168.29.23.kubectl get iomesh iomesh -n iomesh-system -o yamlchunks: - id: 2 # The chunk ID. ip: 192.168.29.23Get the meta leader pod name.
kubectl get pod -n iomesh-system -l=iomesh.com/meta-leader -o=jsonpath='{.items[0].metadata.name}'iomesh-meta-0Access the meta leader pod.
kubectl exec -it iomesh-meta-0 -n iomesh-system -c iomesh-meta bashPerform
chunk unregister. Replace <chunk_id> with the chunk ID obtained from Step 2.Depending on the size of the data in the chunk, executing this command can take from a few minutes to several hours.
/opt/iomesh/iomeshctl chunk unregister <chunk_id>Find
chunkiniomesh.yaml, the default configuration file exported during IOMesh installation, and then editreplicaCount.chunk: replicaCount: 3 # Reduce the value to 2.Apply the modification.
helm upgrade --namespace iomesh-system iomesh iomesh/iomesh --values iomesh.yamlVerify that the number of chunk pods is reduced.
kubectl get pod -n iomesh-system | grep chunkIf successful, you should see output like this:
iomesh-chunk-0 3/3 Running 0 5h5m iomesh-chunk-1 3/3 Running 0 5h5mRun the following command. Then locate the
status.summary.chunkSummary.chunksfield to verify that the chunk was removed.kubectl get iomesh iomesh -n iomesh-system -o yaml