GridGain Developers Hub

GridGain Operator configuration

This section describes how to configure GridGain Operator.

Namespace configuration

Create a Kubernetes namespace in which to deploy GridGain operator

kubectl create namespace <namespace-name>

We suggest that you use the predefined namespace apache-ignite-operator.

Install custom-resource definitions

The CustomResourceDefinition (CRD) API resource defines custom resources that are used by the operator
  1. Download the GridGain Operator bundle, as described in Download GridGain Operator

  2. Install the GridGain CRDs by running the following command:

    kubectl apply -f crds.yaml

RBAC configuration

To manipulate and change Kubernetes resources, the operator needs permissions. Therefore, ClusterRole Bindings specifications that are needed by GridGain Operator are generated by the following commands:

kubectl apply -f role.yaml
kubectl apply -f service_account.yaml
kubectl apply -f role_binding.yaml

The name of the subjects in the ClusterRoleBinding definition must match the name of the ServiceAccount component that is specified when you install the component by using kubectl apply -f service_account.yaml [1].

The namespace of the subjects in the ClusterRoleBinding definition must match the namespace that is specified in the section Create a namespace

For example, consider the following ClusterRoleBinding definition:

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: apache-ignite-operator
subjects:
- kind: ServiceAccount
  name: apache-ignite-operator [1]
  namespace: apache-ignite-operator [2]
roleRef:
  kind: ClusterRole
  name: apache-ignite-operator
  apiGroup: rbac.authorization.k8s.io

The definition indicates that, in your system, you should have created a namespace [1] and a ServiceAccount with a name [2].

Custom resources configuration

You can use custom resources to configure Apache Ignite and GridGain clusters. There are two types of custom resources: Ignite and IgniteConfig.

Ignite resource

Ignite resource contains high-level configuration details such as k8s namespace, cluster name, and number of nodes.

To create a resource, use the following command:

kubectl apply -f  gridgain.com_v1_ignite_cr.yaml

namespace

A namespace at which to deploy a cluster. The default value is apache-ignite-test

cluster_name

The name of the cluster. The default value is apache-ignite-test-cluster

cluster_type [persistence|inmemory]

Defines whether the cluster should use pure in-memory data access or use a persistence storage model.

The default value is persistence. After cluster initialization, the value cannot be changed.

When the value is set to persistence, it is mandatory to configure the StorageClass value that the operator uses to provide the required data stores.

storage_class_name

For cluster_type: "persistence" it is mandatory to have at least one storage class configured for the Kubernetes cluster. By default, if storage_class_name is not configured explicitly, the operator tries to use the attribute is-default-class=True to find the default storage class. If the operator fails to locate the storage class, then the following error is reported:

The system is unable to locate StorageClass

This process is suitable for local development, but for production usage we suggest that you create StorageClass manually. Please check your environment for more details: https://kubernetes.io/docs/concepts/storage/storage-classes/

You can check the available storage classes by using kubectl get sc and then set the appropriate storage class inside gridgain.com_v1_ignite_cr.yaml using:

 ...
  storage_class_name: "standard"
 ...

And, then apply the changes:

kubectl apply -f gridgain.com_v1_ignite_cr.yaml -n <operator-namespace>

cluster_image

The default cluster image is "gridgain/community:latest"`. For GridGain images, changing the value triggers a rolling upgrade procedure. For Apache Ignite, the pods are deleted and re-created.

number_of_nodes

Number of pods in the cluster, the default value is 2.

Storage configuration

If persistent mode is in use, the following values are required. This requirement is ignored for in-memory cluster configuration. All values are in gigabytes
  • work_volume_size: 1, size of the work directory

  • pds_volume_size: 1, size of the pds volume

  • wal_volume_size: 1, size of the WAL volume

  • wal_archive_volume_size: 1, size of the WAL archive

Please refer to the developers-guide/persistence/native-persistence#configuration-properties[Configuration Properties] section for details.

option_libs

Defines which modules should be included in classpath at startup.

Default value: "ignite-kubernetes,ignite-rest-http,ignite-opencensus,control-center-agent"`

Please refer to Enabling Modules section for the details.

jvm_opts

JVM arguments passed to the GridGain instance, with a default value of "-DIGNITE_WAL_MMAP=false -DIGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN=true"`

Please refer to Environment Variables section for the details.

state

Describes the state of a cluster, by default the value is not configured. The only available value is absent. Settings state="absent" triggers cluster termination logic.

IgniteConfig resource

This custom resource is responsible for managing internal cluster configuration though the embedded XML configuration file. Please refer to GridGain configuration docs for details.

To create a resource, use the following command:

kubectl apply -f  gridgain.com_v1_ignite_configmap_cr.yaml

You can modify GridGain or Apache Ignite configuration by changing yaml’s gridgian_conf section:

apiVersion: gridgain.com/v1
kind: IgniteConfig
metadata:
  name: ignite-custom-config
spec:
  gridgian_conf: |-
          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="
                  http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans.xsd">

              <bean class="org.apache.ignite.configuration.IgniteConfiguration">

                  <property name="workDirectory" value="/ignite/work"/>

                  <property name="dataStorageConfiguration">
                      <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                          <property name="defaultDataRegionConfiguration">
                              <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                                  <property name="persistenceEnabled" value="true"/>
                              </bean>
                          </property>
                          <property name="storagePath" value="/ignite/pds"/>
                          <property name="walPath" value="/ignite/wal"/>
                          <property name="walArchivePath" value="/ignite/walarchive"/>
                      </bean>

                  </property>

                  <property name="discoverySpi">
                      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                          <property name="ipFinder">
                              <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
                                  <property name="namespace" value="<namespace>"/>
                                  <property name="serviceName" value="<cluster_name>-service"/>
                              </bean>
                          </property>
                      </bean>
                  </property>
              </bean>
          </beans>

The configuration above contains two placeholders — <namespace>` and <cluster_name> — for k8s IP finder. These placeholders are replaced with the namespace and cluster_name values of Ignite Custom Resource. See Custom Resources Configuration. for details.