Chapter 6. Configuring Network Access to Data Grid

Expose Data Grid clusters so you can access Data Grid Console, the Data Grid command line interface (CLI), REST API, and Hot Rod endpoint.

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 on OpenShift.

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

metadata:
  name: example-infinispan

Procedure

  • Check that the internal service is available as follows:

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

Additional resources

6.2. Exposing Data Grid Through Load Balancers

Use a load balancer service to make Data Grid clusters available to clients running outside OpenShift.

Note

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

Procedure

  1. Include spec.expose in your Infinispan CR.
  2. Specify LoadBalancer as the service type with spec.expose.type.

    spec:
      ...
      expose:
        type: LoadBalancer 1
        nodePort: 30000 2
    1
    Exposes Data Grid on the network through a load balancer service on port 11222.
    2
    Optionally defines a node port to which the load balancer service forwards traffic.
  3. Apply the changes.
  4. Verify that the -external service is available.

    $ oc get services | grep external
    
    NAME                         TYPE            CLUSTER-IP    EXTERNAL-IP   PORT(S)
    example-infinispan-external  LoadBalancer    192.0.2.24    hostname.com  11222/TCP

6.3. Exposing Data Grid Through Node Ports

Use a node port service to expose Data Grid clusters on the network.

Procedure

  1. Include spec.expose in your Infinispan CR.
  2. Specify NodePort as the service type with spec.expose.type.

    spec:
      ...
      expose:
        type: NodePort 1
        nodePort: 30000 2
    1
    Exposes Data Grid on the network through a node port service.
    2
    Defines the port where Data Grid is exposed. If you do not define a port, the platform selects one.
  3. Apply the changes.
  4. Verify that the -external service is available.

    $ oc get services | grep external
    
    NAME                         TYPE            CLUSTER-IP       EXTERNAL-IP   PORT(S)
    example-infinispan-external  NodePort        192.0.2.24       <none>        11222:30000/TCP

6.4. Exposing Data Grid Through Routes

Use an OpenShift Route with passthrough encryption to make Data Grid clusters available on the network.

Procedure

  1. Include spec.expose in your Infinispan CR.
  2. Specify Route as the service type with spec.expose.type.
  3. Optionally add a hostname with spec.expose.host.

    spec:
      ...
      expose:
        type: Route 1
        host: www.example.org 2
    1
    Exposes Data Grid on the network through an OpenShift Route.
    2
    Optionally specifies the hostname where Data Grid is exposed.
  4. Apply the changes.
  5. Verify that the route is available.

    $ oc get routes
    
    NAME                 CLASS    HOSTS   ADDRESS   PORTS   AGE
    example-infinispan   <none>   *                 443     73s

Route ports

When you create a route, it exposes a port on the network that accepts client connections and redirects traffic to Data Grid services that listen on port 11222.

The port where the route is available depends on whether you use encryption or not.

PortDescription

80

Encryption is disabled.

443

Encryption is enabled.