主要步骤
机器:linux
安装 Docker
yum -y install docker
启动 docker
service docker start
查看 docker 状态
systemctl status docker
登录公司仓库地址
docker login --username=用户名 url
docker images
新建 DockerFile
FROM /centos7-jdk8:0.2.2
RUN wget http://mirror.23media.de/apache/jmeter/binaries/apache-jmeter-5.0.tgz &&\
tar xzvf apache-jmeter-5.0.tgz &&\
mv apache-jmeter-5.0 ./jmeterHome &&\
cp -R jmeterHome /usr/local/bin &&\
export PATH=jmeterHome/bin:$PATH &&\
export CLASSPATH=jmeterHome/lib/ext/ApacheJMeter_core.jar:jmeterHome/lib/jorphan.jar &&\
ln -s /usr/local/bin/jmeterHome/bin/jmeter /usr/local/bin/jmeter &&\
ln -s /usr/local/bin/jmeterHome/bin/jmeter-server /usr/local/bin/jmeter-server &&\
sed -i 's/-Xms1g -Xmx1g/-Xms6g -Xmx6g/g' /usr/local/bin/jmeterHome/bin/jmeter&&\
mkdir /jmeterHome/bin/目录
ENV DISPLAY=:0.0
ENV TZ='Asia/Shanghai'
ENTRYPOINT ["sh", "-c", "echo `hostname -i`;jmeter-server -Jserver.rmi.ssl.disable=true -Djava.awt.headless=true -Djava.rmi.server.hostname=`hostname -i`"]
构建镜像
docker build -t tag:版本号 .
推到仓库
docker push tag:版本号
拉取镜像
docker pull tag:版本号
拉取后修改完成后 重新 commit
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>7.0.0</version>
</dependency>
使用K8s的类包进行启动pod
import io.kubernetes.client.Copy;
import io.kubernetes.client.Exec;
import io.kubernetes.client.custom.Quantity;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.proto.V1;
import io.kubernetes.client.util.ClientBuilder;