Eclipse JKube: Cloud Native Java Applications Made Easy
Eclipse JKube is a collection of plug-ins plus a standalone Java library that are used to:
- Build container images using Docker, Java Image Builder (Jib), or Source-to-Image (S2I) build strategies
- Create resource descriptors for Kubernetes or Red Hat OpenShift
- Deploy resource descriptors
If you have a Java project that will be deployed in a Kubernetes or a Red Hat OpenShift environment, this is the right tool for you. Eclipse JKube takes care of everything related to cluster deployment so you, the developer, can concentrate on implementing your application without worrying about where it needs to be deployed.
A Replacement for the Fabric8 Maven Plug-In Project
The Eclipse JKube 1.0.0 GA release also marks the final deprecation of the great Fabric8 Maven Plug-in (FMP) project, and it’s only possible thanks to the hard work and code originally developed by the Fabric8 Maven Plug-in Project Team.
Eclipse JKube is a complete replacement for the FMP project and includes all of its major features as well as new features, bug fixes, and upstream project maintenance capabilities.
If your project relies on the FMP project to create containers based on Apache Maven Java projects, you can now migrate to Eclipse JKube 1.0.0 to take advantage of its new features, including:
- Support for the S2I build strategy for all of our generators
- Support for Jib (Docker-less) build and push
- Separate plug-ins for Kubernetes and OpenShift, including specific resources and build strategies for OpenShift
In addition, all base images are based on Java 11.
A Quick Overview of Eclipse JKube
Eclipse JKube provides Apache Maven plug-ins with specific goals and a set of developer tools for meeting them. Goals include:
- Building container images
- Pushing images to remote registries
- Generating cluster resource configurations
- Deploying resource configurations in your cluster
- Checking container logs
- Watching for project changes
- Debugging Java applications in the cloud
Once the plug-in is configured, you can use Eclipse JKube to build Java container images using the build strategies listed above. Just add our kubernetes-maven-plugin or openshift-maven-plugin dependency and you’re ready to build and deploy your application into your Kubernetes or OpenShift cluster.
Figure 1: How to Include the Kubernetes Maven Plug-In in Your pom.xml File
<build> <plugins> <plugin> <groupId>org.eclipse.jkube</groupId> <artifactId>kubernetes-maven-plugin</artifactId> <version>1.0.0</version> </plugin> </plugins> </build>
Figure 2: How to Build and Deploy Your Java Project From the Command Line
$ mvn clean package k8s:build k8s:resource k8s:apply
The Kubernetes Maven plug-in:
- Generates container images with flexible and powerful configurations that integrate with the Docker daemon service or Jib
- Generates generic Kubernetes descriptors as YAML Ain’t Markup Language (YAML) files
- Provides zero configuration for quick ramp-up in cases where opinionated defaults will be pre-selected
- Provides inline configuration within the plug-in configuration using XML syntax
- Provides external configuration templates for real deployment descriptors that are enriched by the plug-in
The OpenShift Maven plug-in is built on top of the Kubernetes Maven plug-in. It provides all of the configuration capabilities in the Kubernetes Maven plug-in as well as features that are specific to OpenShift. For example, it:
- Manages S2I images, inheriting the S2I tool’s flexible and powerful configuration capabilities
- Generates OpenShift descriptors as YAML files
The Eclipse JKube software infers its configuration from opinionated defaults that work for most Java applications. If this setup is not suitable for your project, you can always customize the plug-in to suit your specific project requirements.