etcd碎片整理增强
Access rate limit exceeded. Please log in to continue.
etcd-auto-defrag
etcd automatic defragmentation plugin.
Function Introduction
Customers hope to execute etcd defragmentation tasks on demand, minimizing impact on the cluster.
After running job.yaml, it will automatically compress the etcd database according to the configured DB_SIZE_THRESHOLD threshold.
Specifications:
- Traverse cluster nodes, if
etcd dbsize exceeds the configured threshold (default 1G), then execute compact and defrag. - If it is a master node, first transfer the leader to any other member that has been defragged, then execute defrag.
- If execution fails, retry according to configuration (default 2 times).
Compilation Preparation
-
Install make, gcc, docker, docker minimum 18.09, recommended 23.0 or above version, and be able to use buildx.
Can be installed through yum install.
Build
Execute build in the code root directory.
docker buildx build . -f build/Dockerfile --provenance=false -t cr.openfuyao.cn/openfuyao/etcd-auto-defrag:latest --load
Deployment
-
Import the image package generated during build into the cluster.
ctr -n k8s.io image import etcd-auto-defrag.tar -
Please refer to the yaml file example under example, modify the required and optional parameters, then apply in the environment.
kubectl apply -f job.yaml
Function Introduction
After running job.yaml, it will automatically compress the etcd database according to the configured DB_SIZE_THRESHOLD threshold:
- If
etcd dbsize exceedsDB_SIZE_THRESHOLD, then executecompactanddefragcommands. - Otherwise, log and exit.
You can view logs using kubectl command.
kubectl get po -n kube-system |grep etcd-auto
kubectl logs -n kube-system {PODNAME}