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

Deploy a Java application using Helm, Part 1

October 19, 2021
Daniel Oh
Related topics:
DevOpsHelmJavaKubernetes
Related products:
Red Hat JBoss Enterprise Application PlatformRed Hat OpenShift

Share:

    To deploy enterprise Java applications with Red Hat JBoss Enterprise Application Platform (JBoss EAP) servers to Red Hat OpenShift, developers have usually needed to learn how to use OpenShift templates or Operators to specify Kubernetes and OpenShift resources such as build config, deployment, volume, environment variables, and application image. This article, the first of a two-part series, explains a simpler way to deploy an enterprise Java application to OpenShift using Helm charts, and how to connect the application to a PostgreSQL database.

    Note: In Part 2, learn how to make this application a bootable JAR using JBoss EAP Extension Pack (XP) with a Helm chart. 

    Helm: Simplifying application deployment on Kubernetes

    Deployment practices are not familiar to application developers because resource definition has traditionally been determined by the IT operations team. When moving rapidly into the DevOps era, developers need to take more responsibility to set appropriate resources in alignment with cloud microservices.

    To solve these problems for developers, Helm was designed to simplify application deployment on Kubernetes. Helm is a software package manager similar to the DNF package manager in Fedora and the Windows Package Manager. Package managers allow developers to install software tools and maintain them (e.g., upgrade, delete, and patch) quickly using a command-line interface or graphical user interface (GUI).

    Developers can install a particular collection of files representing Kubernetes resources by using a Helm chart. When the chart is installed, it is managed by a release. The developer can delete or upgrade the release on demand to make application deployment changes.

    OpenShift also supports a Helm chart to deploy applications with multiple runtime environments, including JBoss EAP. Developers can select and install a Helm chart from OpenShift's developer perspective. Then they can upgrade, roll-back, and uninstall an existing Helm chart (release) during the application lifecycle.

    At the end of this article, you will have a traditional enterprise Java application running on clustered JBoss EAP servers that connect to a PostgreSQL database using the JBoss EAP Helm chart, as shown in Figure 1.

    Note: The Helm charts for JBoss EAP 7.4 are a technology preview feature on OpenShift 4.8, so support is limited when you use these features in production environments.

    Application Development process using JBoss EAP and a PostgreSQL
    Figure 1. Application development process using JBoss EAP and a database.

    Installing a JBoss EAP Helm chart

    Go to the developer console in OpenShift and navigate to the Topology view. Create a new project named eap-helm-demo by clicking the Add to Project icon on the left top and entering EAP into the search box. Then select the Eap74 v1.1.0 Helm chart and click Install Helm Chart, as shown in Figure 2.

    Adding the JBoss EAP 7.4 Helm chart
    Figure 2. Adding the JBoss EAP 7.4 Helm chart.

    Now define a specific build, image, and deployment for an example Todo back-end application. Switch to the YAML view to add Source-to-Image (S2I) build and deploy configurations, as shown in Figure 3.

    Adding the S2I configurations
    Figure 3. Adding the S2I configurations.

    JBoss EAP 7.4 provides a galleon feature pack to add data sources, content trimming, and MicroProfile specifications for enterprise Java applications. Three feature packs (cloud-server, postgresql-datasource, and ejb) are installed while the S2I build runs. The following snippet shows how you can define S2I mode with a galleon feature pack for a PostgreSQL data source in the build section, as well as how to set the clustered servers (with three replicas) in the deploy section:

    build:
      mode: s2i
      s2i:
        featurePacks:
          - org.jboss.eap:eap-datasources-galleon-pack:7.4.0.GA-redhat-00003
        galleonLayers: cloud-server,postgresql-datasource,ejb
      env:
        - name: ARTIFACT_DIR
          value: todo-backend/target
     deploy:
      replicas: 3

    Click the Install button after you add the custom configuration to the YAML file. You can find the entire YAML configuration at the Todo back-end repository.

    Note: You will probably see an ErrImagePull or ImagePullBackOff message in the resources, as shown in Figure 4. No worries—your JBoss EAP 7.4 application is building successfully, but your deployment will report ErrImagePull and ImagePullBackOff until the build is complete.

    ErrImagePull during deployment
    Figure 4. ErrImagePull during deployment.

    Deploying a PostgreSQL database

    Let’s now deploy a new PostgreSQL database to communicate with the JBoss EAP servers. Right-click on the Topology view, then select Database in the pop-up menu. Next, enter postgres into the search box and click on the PostgreSQL (Ephemeral) template, as shown in Figure 5.

    Creating a PostgreSQL database from the OpenShift console
    Figure 5. Creating a PostgreSQL database from the OpenShift console.

    Click Instantiate Template and fill in the following fields, as shown in Figure 6, leaving the other fields at their default values.

    • Database Service Name: todos-db
    • PostgreSQL Connection Username: todos-db
    • PostgreSQL Connection Password: todos-db
    • PostgreSQL Database Name: todos-db

    Then click Create, as shown in Figure 6.

    Key values in the PostgreSQL template
    Figure 6. PostgreSQL configuration in the "Instantiate Template" screen.

    Once the application build is complete, your image is automatically rolled out as shown in Figure 7. Create a connector between the JBoss EAP pod and the PostgreSQL pod via the drag-and-drop feature in the Topology view.

    Successful build and deployment for JBoss EAP application and PostgreSQL
    Figure 7. Successful build and deployment of your JBoss EAP application and PostgreSQL database.

    When you click Open URL, a new web page opens automatically. Copy the route URL for the next step.

    Testing the enterprise Java application

    When the deployment is complete, visit your Todo front-end application by opening a new window in a web browser and pasting in the route URL you copied in the previous step. Then click the go button shown in Figure 8.

    Todo front-end GUI
    Figure 8. Todo front-end GUI.

    Now you should be able to add, update, and remove items in the to-do list, as shown in Figure 9.

    To-do list
    Figure 9. To-do list.

    What’s next

    This article has shown how to deploy traditional enterprise Java applications to the cloud on Red Hat OpenShift using a Helm chart. The JBoss EAP Helm chart lets Java developers specify the application runtime environment on JBoss EAP in terms of build strategy, source repository, galleon feature packs, and server replication (clustering). The procedures shown in this article are much easier for developers than using OpenShift templates or Kubernetes Operators.

    Read next: The next article in this series walks you through how to make this application a bootable JAR using JBoss EAP Extension Pack (XP) with a Helm chart.

    Additional resources:

    • JBoss EAP Quickstarts
    • Getting Started with JBoss EAP for OpenShift Container Platform
    • Instructions for developing Jakarta EE applications for Red Hat JBoss Enterprise Application Platform
    OSZAR »
    Last updated: July 25, 2023

    Related Posts

    • Deploy .NET applications on Red Hat OpenShift using Helm

    • Deploy Node.js applications to Red Hat OpenShift with Helm

    • Advanced Helm support in the OpenShift 4.5 web console

    • Deploy Helm charts with Jenkins CI/CD in Red Hat OpenShift 4

    Recent Posts

    • LLM Compressor: Optimize LLMs for low-latency deployments

    • How to set up NVIDIA NIM on Red Hat OpenShift AI

    • Leveraging Ansible Event-Driven Automation for Automatic CPU Scaling in OpenShift Virtualization

    • Python packaging for RHEL 9 & 10 using pyproject RPM macros

    • Kafka Monthly Digest: April 2025

    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

    OSZAR »