Kubernete JAVA client offical link as below:
https://github.com/kubernetes-client/java
- 按照README,先build java client,记得设置proxy,不然dependency下载会失败
git clone --recursive https://github.com/kubernetes-client/java
cd java
mvn install
- 在IntelliJ IDEA中新建一个maven工程然后导入以下依赖
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>8.0.2</version>
<scope>compile</scope>
</dependency>
- 官方提供了很多sample可以参考https://github.com/kubernetes-client/java/tree/master/examples,自己可以试着写一个sample 创建Deloyment,比如根据test.yaml文件来创建一个deployment
private final String DEPLOYMENT_YAML = "test-deployments.yaml";
private String