如何将使用jmeter[Docker容器]脚本生成的时间序列数据发送到K8S中的influxdb[不是Docker实例]

How to send the time series data generated using jmeter[Docker Container] script to influxdb[Not a Docker instance] in K8S

以下是我的 jmeter 容器的Docker文件

FROM java:8-jdk

ARG JMETER_VERSION="3.3"
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN  ${JMETER_HOME}/bin
ENV JMETER_DOWNLOAD_URL  https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz

# download and extract JMeter
RUN mkdir /tmp/dependencies
RUN curl -L --silent ${JMETER_DOWNLOAD_URL} > /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz

RUN tar -xzf /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz -C /opt && \
    rm -rf /tmp/dependencies

# Set global PATH such that "jmeter" command is found
ENV PATH $PATH:$JMETER_BIN

COPY plugins/lib/*.jar ${JMETER_HOME}/lib/
COPY plugins/lib/ext/*.jar ${JMETER_HOME}/lib/ext/
COPY jmeter.sh ${JMETER_HOME}/bin/

COPY entrypoint.sh /

WORKDIR ${JMETER_HOME}

ENTRYPOINT ["/entrypoint.sh"]

我通过 Jenkins 触发构建,我在其中参数化了场景、环境、线程等。

我的脚本有 influxdb 端点,时间序列数据将发送到这些端点,稍后将在 grafana 中显示。

当我在本地单独设置以下 docker 容器服务并创建它的网络时,它运行良好。

现在,在现实世界中我只需要处理一个 Docker 容器 Jmeter。此时,我不确定如何使用 Jmeter 容器和 InfluxDB 进行卷映射,后者不是容器而是 aws 实例。我将如何向它发送数据?

我们将不胜感激。谢谢

你可以使用 telegraf

https://www.influxdata.com/time-series-platform/telegraf/

它为您提供了多种输入插件,您可以从不同的来源和集成中进行组合

https://www.influxdata.com/products/integrations/

Now, in real-world I have to deal with only one Docker container Jmeter

基于这个假设,从容器的角度来看,唯一真正改变的是 InfluxDB 的端点,它仍然是可配置的*。

在 K8S 世界中,如果你想访问集群外部的服务(例如 AWS 实例上的 InfluxDB 运行),你需要通过 Service without the selectors 的概念将它们映射到集群网络。

* 我共享的 link 的端点有一个名称 'my-service:80'(是的,就是它)