You can find more details in https://github.com/rohanKanojia/eclipse-jkube-demo-project
FROM adoptopenjdk/openjdk11:alpine-jre
MAINTAINER Rakesh Venkatesh
ARG JAR_FILE=target/<file>.jar
WORKDIR /opt/app
COPY ${JAR_FILE} app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<executions>
<execution>
<id>tag-latest</id>
<goals>
<goal>build</goal>
<goal>tag</goal>
<goal>push</goal>
</goals>
<configuration>
<tag>latest</tag>
</configuration>
</execution>
<execution>
<id>tag-version</id>
<goals>
<goal>build</goal>
<goal>tag</goal>
<goal>push</goal>
</goals>
<configuration>
<tag>${project.version}</tag>
</configuration>
</execution>
</executions>
<configuration>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<repository>docker.io/rakgenius/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
Resource files will be located under
target/classes/META-INF/jkube/kubernetes/
<properties>
<jkube.generator.name>rakgenius/${project.name}:${project.version}</jkube.generator.name>
</properties>
<plugins>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.0.0-alpha-4</version>
</plugin>
<plugins>
mvn clean package -DskipTests
mvn k8s:build
Push to docker hub using
mvn k8s:push
mvn k8s:resource
mvn k8s:apply
mvn k8s:log
mvn k8s:debug
If you just want to generate k8s resources and dont want to build docker image then add the below section under profiles
<plugins>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.0.0-alpha-4</version>
<executions>
<execution>
<goals>
<goal>resource</goal>
</goals>
</execution>
</executions>
</plugin>
<plugins>