我在 Cluster k8s 中执行性能测试的 sh 文件,但是当我执行 Pod 时出现一条消息:
level=error msg="Couldn't write stats" error="Action: Deny. Reason: No rule matched. Proceeding with default action." output=InfluxDBv1
SH 文件:
apt install gpg -y
gpg -k
gpg --no-default-keyring --keyring /usr/share/keyrings/xk6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/xk6-archive-keyring.gpg] https://dl.xk6.io/deb stable main" | tee /etc/apt/sources.list.d/xk6.list
apt-get update
apt-get install xk6
k6 run --out influxdb=http://influxdb-k6.monitor.svc.cluster.local ./non-functional-testing/createOrganization.js
我收到了 devoPs 团队某人的回复,他告诉我调用 k6 时会出现此错误,因为这是 InfluxDB2,根据文档 k6 与 InfluxDB2 不兼容。
所以,我尝试将其添加到 sh 文件中:
sudo apt update
sudo apt upgrade
sudo apt search golang-go
sudo apt search gccgo-go
sudo apt install golang-go
go install go.k6.io/xk6/cmd/xk6@latest
# Clone the xk6-disruptor code
git clone https://github.com/grafana/xk6-disruptor.git
cd xk6-disruptor
# Build the custom binary
xk6 build --output xk6-disruptor --with github.com/grafana/xk6-disruptor=.
k6 run --out influxdb=http://influxdb-k6.monitor.svc.cluster.local ./non-functional-testing/createOrganization.js
如 k6 文档中所述,但后来我在日志中得到了 SUdo 无法识别的响应。 有人有办法使用linux在sh文件中安装xk6吗?
你的容器已经以 root 身份运行,无需调用 sudo:
apt update
apt upgrade
...