Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Quick links: redhat.com, Customer Portal, Red Hat's developer site, Red Hat's partner site.

  • You are here

    Red Hat

    Learn about our open source products, services, and company.

  • You are here

    Red Hat Customer Portal

    Get product support and knowledge from the open source experts.

  • You are here

    Red Hat Developer

    Read developer tutorials and download Red Hat software for cloud application development.

  • You are here

    Red Hat Partner Connect

    Get training, subscriptions, certifications, and more for partners to build, sell, and support customer solutions.

Products & tools

  • Ansible.com

    Learn about and try our IT automation product.
  • Red Hat Ecosystem Catalog

    Find hardware, software, and cloud providers―and download container images―certified to perform with Red Hat technologies.

Try, buy, & sell

  • Red Hat Hybrid Cloud Console

    Access technical how-tos, tutorials, and learning paths focused on Red Hat’s hybrid cloud managed services.
  • Red Hat Store

    Buy select Red Hat products and services online.
  • Red Hat Marketplace

    Try, buy, sell, and manage certified enterprise software for container-based environments.

Events

  • Red Hat Summit and AnsibleFest

    Register for and learn about our annual open source IT industry event.

How Helm and JKube simplify Kubernetes management, part 1

April 14, 2022
Rohan Kumar
Related topics:
JavaKubernetes
Related products:
Developer SandboxRed Hat OpenShiftRed Hat OpenShift Container Platform

Share:

Share on twitter Share on facebook Share on linkedin Share with email
  • Benefits of Helm and JKube
  • Generate Helm charts using Eclipse JKube
  • Publish Helm charts to Helm repositories
  • Deploy a Helm chart to OpenShift with Helm CLI
  • Discover more

Tools provided with Kubernetes continually make it easier for Java developers to build applications, store them in registries, and deploy images. This article looks at Helm charts, the fundamental tool for building applications on Kubernetes and the Red Hat OpenShift cloud service, together with Eclipse JKube, which is available as a Kubernetes Maven or Gradle plugin.

The article demonstrates how combining Helm with JKube simplifies Kubernetes manifest management for Java projects. You'll learn how JKube makes it possible for Java developers to automatically generate and publish Helm charts (Figure 1).

Diagram showing how JKube can package a Java application and push it to a Kubernetes cluster using a Helm chart.
Figure 1: JKube can package a Java application and push it to a Kubernetes cluster using a Helm chart.
Benefits of Helm and JKube

Benefits of Helm and JKube

Kubernetes has been here for a while now, and more and more organizations are showing interest in the platform. Java developers are becoming increasingly familiar with packaging their applications into Docker or Podman container images and publishing them to container registries such as Docker Hub and Quay.io.

When working with Kubernetes developers normally need to write Kubernetes configuration files in YAML format. The files can be written manually, of course. But as the complexity of applications increases, it becomes more and more difficult to manage and maintain these Kubernetes manifests.

The Helm project was introduced in 2015-16 to reduce this complexity. It allows Kubernetes users to package Kubernetes manifests in form of Helm charts. A Helm chart is basically a collection of Kubernetes configuration files. It combines pre-configured Kubernetes application resources with corresponding versions into one easily manageable package.

Helm quickly gained popularity and became a graduated project of the Cloud Native Computing Foundation. Helm is now considered the de facto package manager for Kubernetes. Think of it as equivalent to the rpm -i command for Linux systems or pip install for Python. Helm processes an application packaged as a chart, and deploys the application to Kubernetes. Through a command-line interface (CLI), Helm makes installation, upgrades, fetching dependencies, and configuring deployments on Kubernetes smoother.

Benefits of Helm charts include:

  • Easy management of Kubernetes resource manifests
  • Better distribution of Kubernetes manifests across public and private Helm registries
  • Better management of version history for deployments with features such as Helm Rollback

While Helm is useful, it has a learning curve. You can use Helm directly with Java projects, but it requires some effort. It isn't designed with Java developers' workflow in mind.

That's where Eclipse JKube comes in. JKube is a collection of tools and libraries that make your development experience smoother on top of Kubernetes and OpenShift. JKube is available as a Maven or Gradle plugin, and aids Java developers working with cloud-native technologies such as Docker and Kubernetes. JKube provides an end-to-end workflow for Java developers while building container images of applications, generating opinionated manifests, and deploying the images to a Kubernetes cluster. Along with opinionated defaults, JKube also provides a rich set of configuration options via plugin configuration.

Benefits of Eclipse JKube include:

  • Creation of container images and Kubernetes manifests with little to no configuration
  • Creation of Helm charts with little to no configuration
  • Robust operation in both inner and outer loop scenarios
  • Exposure as plugins via Maven and Gradle (with which Java developers are already familiar)
  • No external dependency on any CLI (docker, podman, kubectl, helm, oc, etc.)

This article will specifically focus on generating Helm Charts using JKube. If you're not already familiar with general aspects of JKube usage, please check out Introduction to Eclipse JKube: Java tooling for Kubernetes and Red Hat OpenShift to get up to speed.

Generate Helm charts using Eclipse JKube

Generate Helm charts using Eclipse JKube

Over the rest of this article, you will package a simple Java project into a Helm chart and publish it to a Helm registry using Eclipse JKube. After that, the Java project will be available to any Kubernetes cluster to be installed using the Helm CLI. Then you will install the chart on an OpenShift cluster on the Developer Sandbox for Red Hat OpenShift.

If you already have an existing Java project, you can try adding the plugins in this section to it. Otherwise, you can go to common starter websites such as code.quarkus.io or spring initializer to generate an application through Maven or Gradle. The sample code and configuration used in this article is available in a Github repository.

If you're an Apache Maven user, add the OpenShift Maven plugin to your pom.xml file through the following configuration:

<dependency>
  <groupId>org.eclipse.jkube</groupId>
  <artifactId>openshift-maven-plugin</artifactId>
  <version>${jkube.version}</version>
</dependency>
Copy snippet

Once you've set up your Java project, you'll need to package it into a container image. You can use OpenShift Maven Plugin's build goal to package the application. This goal uses an OpenShift Source-to-Image (S2I) build, which builds the image in a pod and pushes it to OpenShift's internal container registry:

$ ./mvnw oc:build
Copy snippet

Once you've built a container image, you can generate Kubernetes manifests using the resource goal:

$ ./mvnw oc:resource
Copy snippet

After running this command, you should be able to see OpenShift manifests generated in the build output directories:

$ tree target/classes/META-INF/
target/classes/META-INF/
├── jkube
│   ├── openshift
│   │   ├── jkube-helm-maven-deploymentconfig.yml
│   │   ├── jkube-helm-maven-route.yml
│   │   └── jkube-helm-maven-service.yml
│   └── openshift.yml
└── resources
    └── index.html

3 directories, 5 files
Copy snippet

Instead of preparing a Helm chart manually, package these generated OpenShift manifests into a Helm chart by running the following JKube Helm goal:

$ ./mvnw oc:helm
Copy snippet

JKube generates a Helm chart without using the Helm CLI. You should be able to see both compressed and decompressed forms of the generated chart in the build output directory:

$ ls target/jkube-helm-mavejkube-helm-maven-1.0.0-SNAPSHOT-helmshift.tar.gz
target/jkube-helm-maven-1.0.0-SNAPSHOT-helmshift.tar.gz
$ tree target/jkube/helm/
target/jkube/helm/
└── jkube-helm-maven
    └── openshift
        ├── Chart.yaml
        ├── README.md
        ├── templates
        │   ├── jkube-helm-maven-deploymentconfig.yaml
        │   ├── jkube-helm-maven-route.yaml
        │   └── jkube-helm-maven-service.yaml
        └── values.yaml

3 directories, 6 files
Copy snippet

For more advanced configuration options for Helm chart generation, please check out the oc:helm documentation.

Publish Helm charts to Helm repositories

Publish Helm charts to Helm repositories

After you have packaged your application into a Helm chart, you might also want to upload it to a Helm registry. You can upload the chart using the JKube Helm push goal (oc:helm-push for Maven and ocHelmPush for Gradle).

First, you must provide registry details in the plugin configuration. Because this article offers a demo application, we're providing registry details in snapshotRepository. For a real application, you should use stableRepository. The sample configuration is:

     <plugin>
        <groupId>org.eclipse.jkube</groupId>
        <artifactId>openshift-maven-plugin</artifactId>
        <version>${jkube.version}</version>
        <configuration>
          <helm>
            <snapshotRepository>
              <name>ChartMuseum</name>
              <url>http://localhost:8080/api/charts</url>
              <type>CHARTMUSEUM</type>
              <username>user1</username>
            </snapshotRepository>
          </helm>
        </configuration>
      </plugin>
Copy snippet

After you have configured the registry details, you can run the JKube Helm push goal. The following command uses Maven and provides the registry password on the command line as a property:

$ ./mvnw oc:helm-push -Djkube.helm.snapshotRepository.password=secret
Copy snippet

You can check the complete list of configuration options for pushing Helm charts in the oc:helm-push documentation.

Deploy a Helm chart to OpenShift with Helm CLI

Deploy a Helm chart to OpenShift with Helm CLI

After you've pushed your Helm chart to a Helm registry, you can deploy your application by pulling it and installing the chart via the Helm CLI. This section shows several common commands.

List all available Helm registries:

$ helm repo list
Copy snippet

Get the latest chart updates from the registries:

$ helm repo update 
Copy snippet

Search the Helm repositories for the chart you pushed in the previous section. Because you used the snapshot option, the following command has to include the --devel option:

$ helm search repo chartmusuem --devel
NAME                        	CHART VERSION 	APP VERSION	DESCRIPTION
chartmusuem/jkube-helm-maven	1.0.0-SNAPSHOT
Copy snippet

Install the chart:

$ helm install --generate-name chartmusuem/jkube-helm-maven --devel
I0301 22:23:38.971633   37999 request.go:665] Waited for 1.198529433s due to client-side throttling, not priority and fairness, request: GET:https://api.sandbox.openshiftapps.com:6443/apis/security.openshift.io/v1?timeout=32s
NAME: jkube-helm-maven-1646153615
LAST DEPLOYED: Tue Mar  1 22:23:40 2022
NAMESPACE: rokumar-dev
STATUS: deployed
REVISION: 1
TEST SUITE: None
Copy snippet

This command deploys all OpenShift resources contained in this Helm chart to the OpenShift cluster. If you visit the console in the Developer Sandbox, you should see the application deployed in the Topology section (Figure 2).

A screenshot of the OpenShift console showing a Helm chart.
Figure 2: The OpenShift console shows a Helm chart.
​​​​

 

Click Open URL and you should be redirected to your application's page (Figure 3).

Screenshot of the OpenShift console, showing where to open your application.
Figure 3: From the OpenShift console, you can open your application.
Discover more

Discover more

In this article, you learned about the Helm capabilities provided by the Kubernetes Maven and Gradle JKube plugins. Generating and distributing a complete Helm chart for a Java application consists of just adding the desired Maven or Gradle plugin and invoking a few commands. Check out the follow-up article, How to configure Helm charts using JKube, part 2, to learn about the advanced configuration options provided by Eclipse JKube for generating Helm charts and pushing them to Helm registries.

For more information about Eclipse JKube, please check out these articles:

  • Java development on top of Kubernetes using Eclipse JKube
  • Get started with Gradle plugins for Eclipse JKube

You can also check out the Eclipse JKube website. If you like this project, feel free to follow it via these channels:

  • StackOverflow
  • YouTube
  • Twitter
  • Gitter Chat
Last updated: October 31, 2023

Related Posts

  • 3 ways to install a database with Helm charts

  • Migrating from Fabric8 Maven Plugin to Eclipse JKube 1.0.0

  • What's your favorite Kubernetes feature? Hear from the experts

Recent Posts

  • Alternatives to creating bootc images from scratch

  • How to update OpenStack Services on OpenShift

  • How to integrate vLLM inference into your macOS and iOS apps

  • How Insights events enhance system life cycle management

  • Meet the Red Hat Node.js team at PowerUP 2025

What’s up next?

Getting GitOps e-book card

Learn how to navigate the complex world of modern container-based software development and distribution with Getting GitOps: A Practical Platform with OpenShift, Argo CD, and Tekton.

Get the e-book
Red Hat Developers logo LinkedIn YouTube Twitter Facebook

Products

  • Red Hat Enterprise Linux
  • Red Hat OpenShift
  • Red Hat Ansible Automation Platform

Build

  • Developer Sandbox
  • Developer Tools
  • Interactive Tutorials
  • API Catalog

Quicklinks

  • Learning Resources
  • E-books
  • Cheat Sheets
  • Blog
  • Events
  • Newsletter

Communicate

  • About us
  • Contact sales
  • Find a partner
  • Report a website issue
  • Site Status Dashboard
  • Report a security problem

RED HAT DEVELOPER

Build here. Go anywhere.

We serve the builders. The problem solvers who create careers with code.

Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

Sign me up

Red Hat legal and privacy links

  • About Red Hat
  • Jobs
  • Events
  • Locations
  • Contact Red Hat
  • Red Hat Blog
  • Inclusion at Red Hat
  • Cool Stuff Store
  • Red Hat Summit

Red Hat legal and privacy links

  • Privacy statement
  • Terms of use
  • All policies and guidelines
  • Digital accessibility

Report a website issue