Chapter 6. Creating Network Services
Network services provide access to Data Grid clusters for client connections.
6.1. Getting the Service for Internal Connections Copy linkLink copied to clipboard!
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 Copy linkLink copied to clipboard!
Expose Data Grid clusters to clients running outside OpenShift with external services.
Procedure
Specify an external service type with
spec.expose.typein your Infinispan CR and then apply the changes.spec: ... expose:1 type: LoadBalancer2 nodePort: 300003 - 1
- Exposes an external service.
- 2
- Specifies either a
LoadBalancerorNodePortservice 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 isLoadBalancer, the exposed port is11222by default.
LoadBalancerUse 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
-externalservice 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