Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Accessing Red Hat Data Grid in Red Hat OpenShift Container Platform 4

July 18, 2024
Francisco De Melo Junior
Related topics:
ContainersDatabasesGoHelmJavaJava microservicesOperators
Related products:
Red Hat Data GridRed Hat OpenShift Container Platform

    Red Hat Data Grid is a stable product for in-memory distributing caching solutions. In Red Hat OpenShift Container Platform, Data Grid can be installed via Data Grid Operator or Helm Charts can be used to deploy Data Grid 8 and have containers deployed running Data Grid. Those pods can then join together in a cluster—therefore having clustering capabilities.

    Given the deployment of the Data Grid cluster as described above and with the pods deployed, the next step is to access the Data Grid cluster. 

    When accessing the clustering within the OpenShift Container Platform cluster—i.e., when the application access is done inside OpenShift Container Platform—the communication can be via internal service. However, if the application is outside OpenShift Container Platform, Data Grid must expose a service or route to enable the connection, which can be done in a few ways: via Route,  LoadBalancer, and NodePort. 

    Below, these options are described in the context of Data Grid Operator and Data Grid Helm charts, respectively. Parts of this article are derived from this solution: Data Grid 8 Operator Exposition Route vs NodePort vs LoadBalancer in OpenShift 4 

    Application inside OpenShift Container Platform

    The internal service can be used if a hotrod application is deployed in OpenShift Container Platform, either in the same namespace or in another namespace. The internal service won't be accessible outside the OpenShift Container Platform environment.

    The options are either to deploy with the automatically created certificate, use a custom certificate, or do not use the certificate.

    Example:

    When deploying any trivial clustering the internal service will be created:

    $ oc get svc
    NAME                                             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
    example-infinispan                               ClusterIP   172.??.???.???   <none>        11222/TCP   7m28s
    example-infinispan-admin                         ClusterIP   None             <none>        11223/TCP   7m28s
    example-infinispan-ping                          ClusterIP   None             <none>        8888/TCP    7m28s
    infinispan-operator-controller-manager-service   ClusterIP   172.??.???.???   <none>        443/TCP     22m

    And then it can be fetched such as:

     oc get service infinispan-test -o go-template --template='{{.metadata.name}}.{{.metadata.namespace}}.svc.cluster.local{{println}}'

    For more details and an excellent example see this blog post, by Alexander Barbosa. 

    Application outside OpenShift Container Platform

    Data Grid Operator setup

    Given a hotrod application deployed outside OpenShift Container Platform, the Data Grid must be exposed in the Infinispan CustomResource, and can be of three types: Route, (service type) LoadBalancer, and NodePort. 

    Route

    By setting Data Grid Infinispan CR to expose the type Route, on the spec.expose.Type: Route a Route will be created and another service to interact with the application: 

    Example:

    kind: Infinispan
    ...
    spec:
    ...
      expose:
        type: Route
      service:
        type: DataGrid

    Given a route is created, the user can get this route via oc get route:

    $ oc get route
    NAME                        HOST/PORT                                                                                 PATH   SERVICES           PORT    TERMINATION   WILDCARD
    dg-cluster-route-external   example.openshift.org          dg-cluster-route   11222   passthrough   None

    LoadBalancer

    By setting Data Gridto expose the type Route, on the spec.expose.Type: LoadBalancer a service of type LoadBalancer is created. This is a service with a type LoadBalancer, and the OpenShift Container Platform infrastructure must provide the LoadBalancer, as not all providers will have this feature.

    Example:

    kind: Infinispan
    ...
    spec:
    ...
      expose:
        type: LoadBalancer
      service:
        type: DataGrid

    Given a service is created, the user can get the route via oc get svc:

    $ oc get svc
    NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)           AGE
    dg-cluster-lb            ClusterIP      127.0.0.1   <none>                                                                   11222/TCP         30m
    dg-cluster-lb-admin      ClusterIP      127.0.0.1    <none>                                                                   11223/TCP         30m
    dg-cluster-lb-external   LoadBalancer   127.0.0.1     example.amazonaws.com   11222:30436/TCP   30m
    dg-cluster-lb-ping       ClusterIP      None             <none>                                                                   8888/TCP          30m

    In case the provider does not have that feature, e.g., in case you are running OpenShift on bare metal that does not have a LoadBalancer implementation available, the following error message will appear:

    LoadBalancer expose type is not supported on the target platform

    NodePort

    By setting Data Grid to expose the type Route, on the spec.expose.Type: NodePort a service of type NodePort is created.

    Example:

    kind: Infinispan
    ...
    spec:
    ...
      expose:
        type: NodePort
      service:
        type: DataGrid

    Given a service is created, the user can get the route via oc get svc:

    $ oc get svc
    NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)           AGE
    dg-cluster-lb            ClusterIP      127.0.0.1   <none>                                                                   11222/TCP         30m
    dg-cluster-lb-admin      ClusterIP      127.0.0.1    <none>                                                                   11223/TCP         30m
    dg-cluster-lb-external   NodePort   127.0.0.1     example.amazonaws.com   11222:30436/TCP   30m
    dg-cluster-lb-ping       ClusterIP      None             <none>                                                                   8888/TCP          30m

    Data Grid Helm Charts

    For Data Grid the options are the same: deploy.expose.type.

    Summary

    Below I summarized in the table below the comparison of each one.

    Comparison Table

    Table 1: Comparison of expose
    Type of exposeHow to set it up in Data Grid OperatorHow to set it up in Data Grid Helm ChartsImplications
    NodePortspec.expose.Type: NodePortdeploy.expose.type NodePortData Grid Operator will create a service of type NodePort
    LoadBalancerspec.expose.Type: LoadBalancerdeploy.expose.type LoadBalancerData Grid Operator will create a service of type LoadBalancer
    Routespec.expose.Type: Routedeploy.expose.type RouteData Grid Operator will create a service of type ClusterIP and a HaProxy's Route

    Conclusion

    Above I described the approaches to access Data Grid deployed in OpenShift Container Platform 4, which include NodePort, LoadBalancer, and Routing exposition. Each method provides some feature/functionality but has its disadvantages as well.

    The usage of Route for example, although very simple in OpenShift Container Platform 4 and provides load balancing, will require the limitations/boundaries of OpenShift Container Platform 4's Ingress controller and therefore HaProxy to be respected.

    This is important because, in scenarios of externalization for Data Grid, HaProxy might overwrite the cookies that are created by an application externalizing to Data Grid given its default template the original cookie is not preserved. Regarding HaProxy configurations, it is usually configured via annotations, and not all features have annotations ready available. For haproxy-config.template customization, this is currently not possible in OpenShift Container Platform 4, but perhaps it will be added later.

    Moreover, the fact that HaProxy is the middleman, has implications in terms of settings but also SNI validations, where although an OpenShift Container Platform 4 route created by Data Grid is passthrough, the Route will impose SNI and there is a default cert being used so encryption settings might need to be considered.

    On the other hand, the usage of service type LoadBalancer does not provide full load balancing capabilities such as HaProxy, but it requires the underneath OpenShift Container Platform infrastructure to provide this feature. NodePort is basic and does not provide load balancing to get external traffic directly to the Data Grid Cluster. 

    Finally, in terms of deployment, both Data Grid Operator and Helm Charts provide an easy approach to deploy the specific Ingress method at the choice of the user with a simple setting: 

    • Infinispan Custom Resource in the case of DG Operator deployment
    • The values YAML in the case of Helm Charts deployment.

    Additional resources

    To learn more about Data Grid 8.4 see its main page. And for Data Grid Operator see its main guide. Finally, Data Grid 8 Operator Exposition Route vs NodePort vs LoadBalancer in OpenShift 4 brings other interesting topics about externalization using Route vs LoadBalancer vs NodePort. 

    For any other specific inquiries, please open a case with Red Hat support. Our global team of experts can help you with any issues.

    Special thanks to Alexander Barbosa for his input and contributions throughout those years in Data Grid.

    Related Posts

    • Securely connect Quarkus and Red Hat Data Grid on Red Hat OpenShift

    • Using Red Hat Data Grid to power a multi-cloud real-time game

    • Build embedded cache clusters with Quarkus and Red Hat Data Grid

    • Red Hat Data Grid on Three Clouds (the details behind the demo)

    Recent Posts

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    What’s up next?

    Red Hat Data Grid is an in-memory, distributed, NoSQL datastore solution that boosts application performance, provides greater deployment flexibility, and minimizes the overhead of standing up new applications. Download the Cache configuration in Red Hat Data Grid cheat sheet for a quick reference for creating and configuring Data Grid caches, complete with configuration examples.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.