1.安裝https://github.com/kubernetes-sigs/kustomize
兩種方法:
go get github.com/kubernetes-sigs/kustomize
或者:
mkdir -p $GOPATH/src/github.com/kubernetes-sigs/
cd $GOPATH/src/github.com/kubernetes-sigs/
git clone https://github.com/kubernetes-sigs/kustomize.git
cd kustomize
make
cp kustomize/kustomize /usr/bin/
2. 部署kubeston
mkdir -p $GOPATH/src/github.com/xridge
cd $GOPATH/src/github.com/xridge
git clone https://github.com/xridge/kubestone.git
cd kubestone
kustomize build $GOPATH/src/github.com/xridge/kubestone/config/default | kubectl create -f -
kubectl create namespace kubestone
3. 執行測試
kubectl create --namespace kubestone -f https://raw.githubusercontent.com/xridge/kubestone/master/config/samples/perf_v1alpha1_iperf3.yaml
4. 查看結果
執行如下操作:
kubectl get pods,jobs --namespace kubestone
結果爲:
NAME READY STATUS RESTARTS AGE
pod/iperf3-sample-client-q6hr5 0/1 Completed 0 2d15h
NAME COMPLETIONS DURATION AGE
job.batch/iperf3-sample-client 1/1 12s 2d15h
執行:
kubectl logs job.batch/iperf3-sample-client --namespace kubestone
#顯示結果爲:
Connecting to host iperf3-sample, port 5201
[ 5] local 10.42.1.39 port 41180 connected to 10.42.0.38 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 241 MBytes 2.02 Gbits/sec 225 348 KBytes
[ 5] 1.00-2.00 sec 243 MBytes 2.04 Gbits/sec 238 289 KBytes
[ 5] 2.00-3.00 sec 256 MBytes 2.15 Gbits/sec 34 369 KBytes
[ 5] 3.00-4.00 sec 252 MBytes 2.11 Gbits/sec 58 431 KBytes
[ 5] 4.00-5.00 sec 271 MBytes 2.27 Gbits/sec 142 527 KBytes
[ 5] 5.00-6.00 sec 261 MBytes 2.19 Gbits/sec 43 457 KBytes
[ 5] 6.00-7.00 sec 267 MBytes 2.24 Gbits/sec 79 460 KBytes
[ 5] 7.00-8.00 sec 163 MBytes 1.37 Gbits/sec 182 462 KBytes
[ 5] 8.00-9.00 sec 221 MBytes 1.86 Gbits/sec 220 366 KBytes
[ 5] 9.00-10.00 sec 237 MBytes 1.99 Gbits/sec 32 390 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 2.36 GBytes 2.02 Gbits/sec 1253 sender
[ 5] 0.00-10.04 sec 2.35 GBytes 2.01 Gbits/sec receiver
iperf Done.