编译kube-batch项目和自己开发的压测工具density。
编译kube-batch
编译kube-batch镜像
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # go build
export GOPATH=/home/wangb/projects
export GO111MODULE="off"
cd /home/wangb/projects/src/github.com/kubernetes-sigs/kube-batch
make clean
make
# make image
image_dir=/home/wangb/projects/src/github.com/kubernetes-sigs/kube-batch/deployment/images
rm -rf ${image_dir}/kube-batch
cp _output/bin/kube-batch ${image_dir}
cd ${image_dir}
docker build -t kube-batch:test .
|
编译 density
density是自己开发的对k8s调度器和kube-batch调度器进行性能测试的工具
1
2
3
4
5
6
7
| export GOPATH=/home/wangb/projects/
export GO111MODULE="off"
cd /home/wangb/projects/src/github.com/kubernetes-sigs/kube-batch/cmd/perf-test/cmd/density
go clean
go build -o density
|
density 测试命令
创建测试namespace,density在density-test命名空间下进行pod调度性能测试
1
| kubectl create namespace density-test
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| # test cmd
# pnum 需调度pod总数
# qps density的client发射qps参数,影响pod的创建速率
./density --pnum 50 --qps 200
./density --pnum 3 --qps 100
# kube-batch scheduler
./density --name kube-batch --pnum 1000 --qps 1000
# k8s scheduler
./density --name default --pnum 1000 --qps 1000
# kube-batch scheduler
./density --name kube-batch --pnum 5000 --qps 1000
# k8s scheduler
./density --name default --pnum 5000 --qps 1000
|
清理测试pod资源
1
2
3
| # batch delete terminating pods
NAMESPACE=density-test
kubectl get po -n $NAMESPACE |awk '{print $1}' |xargs kubectl delete pod -n $NAMESPACE --force --grace-period=0
|
清理namespace:density-test资源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| # 强制删除ns为test- 的资源
kubectl get ns |grep density-test |awk '{print $1}' |xargs kubectl delete ns --force --grace-period=0
cd /tmp/
ns_test=$(kubectl get ns |grep density-test |grep Terminating|awk '{print $1}')
kubectl get namespace ${ns_test} -o json >temp.json
sed -i '12,19d' temp.json
sed -i 's/},/}/g' temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 192.168.1.100:8080/api/v1/namespaces/${ns_test}/finalize
|