Deploying and Managing Multiple Instances of Data Gateway in Kubernetes

This topic describes how to create multiple Data Gateway instances in Kubernetes, for use in BI tools. This allows parallel processing of SQL queries.

The topics in this section assume basic knowledge of the GigaSpaces platform. If you aren't familiar with GigaSpaces, review the contents of the general Getting Started section before performing the tasks described here.

Prerequisites

This topic describes how to do basic and intermediate-level deployment tasks for the Space and the GigaSpaces platform, using simple Helm commands.

 

Deploying the GigaSpaces Platform

In order to prepare the environment for use, first the Platform Manager must be deployed. This deploys two pods: the Manager pod, and the Operator pod.

Note that Platform Manager is deployed by using a Helm chart, and further operations can also be performed using the UI, CLI or REST-API tools.

Create a local repository from the Helm server and install GigaSpaces

The xap chart used in the following example is an "umbrella" chart that references more than one Helm chart.

Update the GigaSpaces repo locally:

helm repo add gigaspaces https://resources.gigaspaces.com/helm-charts
helm repo update

Unpack the GigaSpaces charts:

helm pull gigaspaces/xap --version=15.2 --untar

Deploy the GigaSpaces Manager and Operator pods:

helm install xap ./xap --set operator.manager.name=xap

View the result in the CLI via the kubectl get pods command.

Monitoring the Cluster in Kubernetes

After running the commands show below, you can monitor the cluster you deployed using the following administration tools.

  • Helm: Run the following command to print the status of the xap deployment in the command window.
helm status xap
  • Kubectl: run the following command to print the name, description, and status of the Pods in the command window. A list of events is also printed, which can be used for troubleshooting purposes. For example, if you detected a problem in one of the Pods, you can see the Pod termination reason and exit code.
kubectl get pods

Repeat the get pods command shown below, until all of the Status fields are "Running".

kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
xap-grafana-5574c8bcd5-v2xsr    1/1     Running   0          5m14s
xap-influxdb-0                  1/1     Running   0          5m14s
xap-operator-57d9d445ff-slsrr   1/1     Running   0          5m14s
xap-xap-manager-0               1/1     Running   0          5m14s		
  • grafana and influxdb, installed by default, provide the metrics and database engine to create grafana dashboards for the system.

  • operator allows Kubernetes to create custom GigaSpaces resources, such as processing units (pus).

  • xap-manager is the central processing and management module of the GigaSpaces environment.

Find the external Kubernetes URL in the CLI via the kubectl get services command:

kubectl get services
NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                        AGE
kubernetes                ClusterIP      10.96.0.1        <none>        443/TCP                                        3h50m
webhook-server            ClusterIP      10.98.86.137     <none>        443/TCP                                        2m36s
xap-grafana               ClusterIP      10.98.32.89      <none>        3000/TCP                                       2m36s
xap-influxdb              ClusterIP      10.109.178.226   <none>        8086/TCP,8088/TCP                              2m36s
xap-xap-manager-hs        ClusterIP      None             <none>        2181/TCP,2888/TCP,3888/TCP,4174/TCP            2m36s
xap-xap-manager-service   LoadBalancer 10.101.178.201   localhost     8090:31817/TCP,4174:31029/TCP,8200:31231/TCP   2m36s

The externally accessible URL is type LoadBalancer. In this example, it is localhost.

View the result via the Ops Manager URL

The general format for the URL is <LoadBalancer External-IP>:8090/services.

In this example, the URL is localhost:8090/services

Install a Space called "demo"

In this example, we install a processing unit with one partition. Data can be stored in the partition.

helm pull gigaspaces/xap-pu --version=15.2 --untar
helm install demo ./xap-pu/ --set manager.name=xap,partitions=1

View the result in the CLI via the kubectl get pods command:

Repeat the get pods command shown below, until all of the Status fields are "Running".

kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
xap-grafana-5574c8bcd5-v2xsr    1/1     Running   0          7m34s
xap-influxdb-0                  1/1     Running   0          7m34s
xap-operator-57d9d445ff-slsrr   1/1     Running   0          7m34s
xap-xap-manager-0               1/1     Running   0          7m34s
demo-xap-pu-0                   1/1     Running   0          15s
				

Install a Microservice

In this example, we install an additional processing unit with no partitions, only code. See Deploying a Custom Processing Unit for details on how to run the microservice Docker image.

helm install pu ./xap-pu/ --set manager.name=xap

View the result in the CLI via thekubectl get pods command:

Repeat the get pods command shown below, until all of the Status fields are "Running".

kubectl get pods
NAME                            READY   STATUS    RESTARTS   AGE
demo-xap-pu-0                   1/1     Running   0          4m52s
pu-xap-pu-0                     1/1     Running   0          3m5s
xap-grafana-5574c8bcd5-6z6mc    1/1     Running   0          17m
xap-influxdb-0                  1/1     Running   0          17m
xap-operator-57d9d445ff-zhlp2   1/1     Running   0          17m
xap-xap-manager-0               1/1     Running   0          17m
				

View the result via the Ops Manager URL

The general format for the URL is <LoadBalancer External-IP>:8090/services.

In this example, the URL is localhost:8090/services

Configuration Options

The following configuration options can be specified when using the charts.

For the xap-pu chart:

  • partitions=2 — scale out/in to change the number of partitions.

  • ha=true/false — each primary Data Pod has one backup Data Pod. Default is false.

  • antiAffinity.enabled=true/false — spread the partitions across nodeszones or nodes. Default is false.

  • Anti affinity can operate in two ways:

    • Deploy primary and backup partitions on separate Kubernetes zones (default).

    • Deploy these two partitions on separate servers, but not necessarily on different zones.
      For this second option, you must also specify the following parameter when deploying the operator:
      --set antiAffinity.topology=kubernetes.io/hostname

     

  • For the xap umbrella chart:

  • metrics.enabled=true/false — enable or disable Grafana metrics. Default is true.

Next Steps...

The following topics illustrate additional features of GigaSpaces.