A logo showing the text blog.marcnuri.com
Español
Home»Java»Eclipse JKube introduction: Java tools and plugins for Kubernetes and OpenShift

Recent Posts

  • MCP Tool Annotations: Adding Metadata and Context to Your AI Tools
  • Fabric8 Kubernetes Client 7.2 is now available!
  • Connecting to an MCP Server from JavaScript using AI SDK
  • Connecting to an MCP Server from JavaScript using LangChain.js
  • The Future of Developer Tools: Adapting to Machine-Based Developers

Categories

  • Artificial Intelligence
  • Front-end
  • Go
  • Industry and business
  • Java
  • JavaScript
  • Legacy
  • Operations
  • Personal
  • Pet projects
  • Tools

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • August 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • February 2020
  • January 2020
  • December 2019
  • October 2019
  • September 2019
  • July 2019
  • March 2019
  • November 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • December 2017
  • July 2017
  • January 2017
  • December 2015
  • November 2015
  • December 2014
  • March 2014
  • February 2011
  • November 2008
  • June 2008
  • May 2008
  • April 2008
  • January 2008
  • November 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007

Eclipse JKube introduction: Java tools and plugins for Kubernetes and OpenShift

2020-10-14 in Java tagged Eclipse / Eclipse JKube / Kubernetes / Open Source / OpenShift by Marc Nuri | Last updated: 2023-08-24
Versión en Español

Introduction

In this post, I will present Eclipse JKube and how you can get started with the project to deploy your Java applications into the Cloud. Eclipse JKube is a collection of plugins and libraries that will help you develop cloud-native Java applications. It includes tools to build container images using Docker, JIB, or S2I build strategies. In addition, JKube provides the means to generate cluster configuration files (YAML) and deploy them into your Kubernetes or OpenShift clusters.

JKube’s history

Eclipse JKube is not an original project but a rebranding and update of the great Fabric8 Maven Plugin. Fabric8 Maven Plugin was part of the larger Fabric8 ecosystem which is now discontinued.

The logo of Fabric8
The logo of Fabric8

Despite being discontinued, there are still a variety of projects that remain active in the fabric8 ecosystem.

Regarding JKube, in November 2019, the project was donated to and accepted by the Eclipse Foundation. Development efforts have continued under this new name and the 1.0.0 release was finally made generally available (GA) in September 2020.

JKube components

As of now, JKube provides 5 different components:

  • JKube Kit: Contains the core logic of the library and is used by the rest of the components (plugins).
  • Kubernetes Maven Plugin: Specifically designed to target vanilla Kubernetes clusters. Builds container images using Docker or JIB. Generates standard Kubernetes configuration descriptors.
  • OpenShift Maven Plugin: Built on top of the Kubernetes Maven Plugin, provides OpenShift specific features. Builds container images using S2I. Generates OpenShift specific configuration descriptors.
  • Kubernetes Gradle Plugin: Provides the same features as the Kubernetes Maven Plugin but for Gradle projects.
  • OpenShift Gradle Plugin: Provides the same features as the OpenShift Maven Plugin but for Gradle projects.

Getting started

The fastest way for you to get started with JKube is by using one of the provided Maven Plugins. Making your application Kubernetes friendly is as simple as adding the plugin to the build section of your project:

pom.xml
<build>
    <plugins>
        <!-- ... -->
        <plugin>
          <groupId>org.eclipse.jkube</groupId>
          <artifactId>kubernetes-maven-plugin</artifactId>
          <version>1.18.1</version>
        </plugin>
    </plugins>
    <!-- ... -->
</build>

Or in case you are targeting an OpenShift cluster:

pom.xml
<build>
    <plugins>
        <!-- ... -->
        <plugin>
          <groupId>org.eclipse.jkube</groupId>
          <artifactId>openshift-maven-plugin</artifactId>
          <version>1.18.1</version>
        </plugin>
    </plugins>
    <!-- ... -->
</build>

If your application is based on one of the supported frameworks (Spring, Quarkus, Vert.x, OpenLiberty, etc.), then this is all the configuration you’ll need. You can also check the official quickstart section on JKube’s main website to find an example that suits your specific needs.

Building the container image

Once you’ve compiled and packaged your application by running the mvn clean package command, it’s time to build the container image.

Note

If you are using Minikube as a target cluster, you can share your cluster’s Docker registry by running eval $(minikube docker-env). This way you won’t need to push your image to a remote shared registry.

You can instruct JKube to build a Docker image for your Maven project by running the following command:

mvn k8s:build

Pushing the image to a container registry

This step won’t be necessary if you are using Minikube and you shared your cluster’s Docker daemon. You won’t need to run this step either if you are using the OpenShift Maven Plugin.

If however, you need to push your image, you’ll most probably need to configure your resulting image name. You can do so very easily using a Maven property:

pom.xml
<properties>
  <!-- ... -->
  <jkube.generator.name>your-docker-hub-user/image-name:latest</jkube.generator.name>
</properties>

You can now run the Maven goal to push your image:

mvn k8s:push

Generating configuration resources

JKube also provides a way to infer your project's requirements and generate cluster configuration manifests (YAML files) for your application.

If you are using one of the supported frameworks, all you’ll have to do is run:

mvn k8s:resource

Deploying your application

Finally, you can deploy the generated configuration files to your cluster. Eclipse JKube internally uses the Fabric8 Kubernetes Client to access your cluster by reading your .kube/config. Unless you want to target a different cluster, you won’t need to provide any specific configuration either.

mvn k8s:apply

If everything goes well, your application will be available on the cluster.

If you are using OpenShift, JKube will even create a Route for you. Your application should be publicly available under the preconfigured route.

Cleaning up

In case anything went wrong, or simply to delete your application from the cluster, you can run the following command:

mvn k8s:undeploy

Additional Maven goals

JKube also provides additional goals to simplify your life as a developer:

  • k8s:log: Tails the log of the deployed application.
  • k8s:debug: Enables debugging for your Java application in the cluster.
  • k8s:watch: Monitors your project workspace for changes to automatically redeploy your application.
  • Many more…

EclipseCon 2020

At EclipseCon 2020, I gave an introductory talk to Eclipse JKube at EclipseCon 2020. The video below is the recording of the session where I explain in detail what we've covered in this article:

The EclipseCon presentation includes two live demos.

Conclusion

In this article, I've introduced you to Eclipse JKube and how to get started. I've also shown you how to set up your project and the main Maven goals provided by JKube’s plugins.

If you want to learn more about Eclipse JKube, visit the project's website and documentation. Don't forget to follow jkubeio on Twitter to get the latest updates and news about the project.

The logo of Eclipse JKube
The logo of Eclipse JKube
Twitter iconFacebook iconLinkedIn iconPinterest iconEmail icon

Post navigation
A year at Red HatPrometheus and Grafana setup in Minikube
© 2007 - 2025 Marc Nuri