Chapter 6. Creating Network Services


Network services provide access to Data Grid clusters for client connections.

6.1. Getting the Service for Internal Connections

By default, Data Grid Operator creates a service that provides access to Data Grid clusters from clients running in OpenShift.

This internal service has the same name as your Data Grid cluster, for example:

metadata:
  name: example-rhdatagrid

Procedure

  • Check that the internal service is available as follows:

    $ oc get services
    
    NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)
    example-rhdatagrid ClusterIP   192.0.2.0        <none>        11222/TCP

Reference

6.2. Exposing Data Grid to External Clients

Expose Data Grid clusters to clients running outside OpenShift with external services.

Procedure

  • Specify an external service type with spec.expose.type in your Infinispan CR and then apply the changes.

    spec:
      ...
      expose: 1
        type: LoadBalancer 2
        nodePort: 30000 3
    1
    Exposes an external service.
    2
    Specifies either a LoadBalancer or NodePort service resource type.
    3
    Defines the port where the external service is exposed. If you do not define a port, and the service type is NodePort, the platform selects a port to use. If the service type is LoadBalancer, the exposed port is 11222 by default.
LoadBalancer

Use for OpenShift clusters where a load balancer service is available to handle external network traffic. You can then use the URL for the load balancer service for client connections.

To access Data Grid with unencrypted Hot Rod client connections you must use a load balancer service.

NodePort
Use for local OpenShift clusters.

Verification

  • Check that the -external service is available.
$ oc get services | grep external

NAME                         TYPE            CLUSTER-IP       EXTERNAL-IP   PORT(S)
example-rhdatagrid-external  LoadBalancer    192.0.2.24       <none>        11222/TCP

Reference

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.