Outdated Version

You are viewing an older version of this section. View current production version.

Helm Chart for IBM Cloud Pak for Data

Introduction

Use these steps to deploy SingleStore DB (MemSQL) in a Kubernetes environment via the Helm chart for IBM Cloud Pak for Data®.

Cluster Admin Prerequisites

  1. Determine the project (namespace) in which to deploy SingleStore DB. SingleStore suggests deploying in the same project where the IBM Cloud Pak for Data control plane is installed

  2. Determine which StorageClass to use.

    Avoid using a StorageClass with an NFS-based provisioner. Ideally, you should choose a StorageClass that uses a block storage-based provisioner that supports volume expansion and the WaitForFirstConsumer binding mode.

    While cluster admin privileges are required to query or create a StorageClass, they are not required to use the StorageClass in the deployment.

  3. Run the following command to determine the fsGroup to use for the deployment.

    oc get project <project-name> -o=jsonpath=\
    '{.metadata.annotations.openshift\.io/sa\.scc\.supplemental-groups}{"\n"}'
    

    This command’s output will be similar to 1096160000/10000. Note that the actual numbers may differ. Copy the number before the slash (/) as this is the fsGroup ID that will be required in a later step.

  4. To deploy the required CRD, save the following content in a file named memsql-cluster-crd.yaml.

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    metadata:
      name: memsqlclusters.memsql.com
    spec:
      group: memsql.com
      names:
        kind: MemsqlCluster
        listKind: MemsqlClusterList
        plural: memsqlclusters
        singular: memsqlcluster
        shortNames:
          - memsql
      scope: Namespaced
      version: v1alpha1
      subresources:
        status: {}
      additionalPrinterColumns:
      - name: Aggregators
        type: integer
        description: Number of MemSQL Aggregators
        JSONPath: .spec.aggregatorSpec.count
      - name: Leaves
        type: integer
        description: Number of MemSQL Leaves (per availability group)
        JSONPath: .spec.leafSpec.count
      - name: Redundancy Level
        type: integer
        description: Redundancy level of MemSQL Cluster
        JSONPath: .spec.redundancyLevel
      - name: Age
        type: date
        JSONPath: .metadata.creationTimestamp
    
  5. Run the following command to apply the CRD file.

    oc apply -f memsql-cluster-crd.yaml
    

Deployment Prerequisites

  1. Obtain a SingleStore license from the SingleStore Customer Portal.

  2. Select the SingleStore DB images to use. Two Docker images are required for the deployment.

    The node image is the SingleStore DB database engine, and can be found on Docker Hub.

    The Operator image is used to manage the SingleStore DB engine deployment in Kubernetes environment, and can also be found on Docker Hub.

Info

If you opt to deploy in an air-gapped environment (an environment with no outside connectivity), you must first pull these two images down and then upload them to your private Docker registry.

To do so, run the following commands for both the node image and the Operator image. Note that these commands may differ depending on the images selected.

docker pull memsql/node:centos-7.1.12-4ee69e2d18
docker tag docker pull memsql/node:centos-7.1.12-4ee69e2d18 \
<private_registry>/memsql/node:centos-7.1.12-4ee69e2d18
docker push <private_registry>/memsql/node:centos-7.1.12-4ee69e2d18

Deploy SingleStore DB/MemSQL

  1. Run the following commands to add the SingleStore Helm chart for IBM Cloud Pak for Data.

    helm repo add singlestoredb-ibmcloudpakfordata-charts https://helm.singlestore.com/ibmcloudpakfordata
    ****
    "singlestoredb-ibmcloudpakfordata-charts" has been added to your repositories
    
    helm repo list
    ****
    NAME                                    URL
    singlestoredb-ibmcloudpakfordata-charts   https://helm.singlestore.com/ibmcloudpakfordata
    
    helm search repo singlestoredb-ibmcloudpakfordata-charts -o yaml
    ****
    - app_version: ""
      description: SingleStore DB for IBM Cloud Pak for Data
      name: singlestoredb-ibmcloudpakfordata-charts/singlestoredb-ibmcloudpakfordata
      version: 1.0.0
    

    The last command will list the Helm chart versions that singlestoredb-ibmcloudpakfordata-charts offers. Select the desired chart version.

  2. Authenticate with the OpenShift API server.

    oc login OpenShift_URL:port
    
  3. Switch to the project that you selected in Cluster Admin Prerequisites.

    oc project <project-name>
    
  4. Create a values-override.yaml file to customize your deployment. Run the following command to see an example of values-override.yaml file.

    helm show readme \
    singlestoredb-ibmcloudpakfordata-charts/singlestoredb-ibmcloudpakfordata
    

    Use the StorageClass that you selected in Cluster Admin Prerequisites.

    Substitute the fsGroup value with the value you copied in Cluster Admin Prerequisites.

    In general, when creating the values-override.yaml file, you may want/need to customize the following configuration values:

    operatorImage
    nodeImageRepo
    nodeImageTag
    nodeImageVersion
    coresPerUnit
    memoryPerUnit
    memsqlCluster:
      # choose either license or licenseSecret, but not both
      license
      licenseSecret:
        name
        Key
      # choose either adminHashedPassword or adminHashedPasswordSecret, but not both
      adminHashedPassword
      adminHashedPasswordSecret:
        name
        key
      aggregatorSpec:
        Count
        height
        storageGB
      leafSpec:
        count:
        height
        storageGB
    
  5. Run the following command to deploy SingleStore DB.

    helm install <deployment-name> singlestoredb-ibmcloudpakfordata-charts/singlestoredb-ibmcloudpakfordata \
    [--version x.y.z] -f values-override.yaml
    

    Not that the version (--version x.y.z) is optional.

  6. Wait for the deployment to complete and run the following commands. Note that ${CLUSTER_NAME} is the {{ .Values.memsqlCluster.name }} from the Helm chart.

    CLUSTER_NAME=$(helm get values -a  -o \
    json <deployment-name> | jq -r '.memsqlCluster.name')
    
    oc get memsqlcluster ${CLUSTER_NAME} -o=jsonpath='{.status.phase}{"\n"}'
    

    The SingleStore DB server deployment is complete when Running is displayed after running the above commands.

  7. After the deployment completes, run the following command to display the two SingleStore DB service endpoints that are created during the deployment.

    oc get svc | grep ${CLUSTER_NAME}
    

    The svc-${CLUSTER_NAME}-ddl and svc-${CLUSTER_NAME}-dml service endpoints can be used to connect to SingleStore DB using a MySQL compatible client. Note that svc-${CLUSTER_NAME}-dml only exists if {{ .Values.memsqlCluster.aggregatorSpec.count }} is greater than 1.

    The output will resemble the following (actual values will vary):

    NAME                     TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)          AGE
    svc-memsql-cluster       ClusterIP      None            <none>         3306/TCP         42h
    svc-memsql-cluster-ddl   LoadBalancer   172.21.29.233   169.46.26.10   3306:32278/TCP   42h
    svc-memsql-cluster-dml   LoadBalancer   172.21.6.77     169.46.26.11   3306:30922/TCP   42h
    

    You may also obtain DDL and DML endpoints from the SingleStore DB cluster status using the following commands:

    oc get memsqlcluster ${CLUSTER_NAME} -o jsonpath='{.status.ddlEndpoint}{"\n"}'
    
    oc get memsqlcluster ${CLUSTER_NAME} -o jsonpath='{.status.dmlEndpoint}{"\n"}'
    

    The output will resemble the following (actual values will vary):

    169.46.26.10:3306
    169.46.26.11:3306
    

    Refer to Data Definition Language (DDL) and Data Manipulation Language (DML) for more information.

Resources