Skip to content

Create a NebulaGraph cluster

This topic introduces how to create a NebulaGraph cluster with the following two methods:

  • Create a NebulaGraph cluster with Helm
  • Create a NebulaGraph cluster with Kubectl

Prerequisites

Create a NebulaGraph cluster with Helm

Legacy version compatibility

The 1.x version NebulaGraph Operator is not compatible with NebulaGraph of version below v3.x.

  1. Add the NebulaGraph Operator Helm repository.

    helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
    
  2. Update information of available charts locally from chart repositories.

    helm repo update
    
  3. Set environment variables to your desired values.

    export NEBULA_CLUSTER_NAME=nebula         # The desired NebulaGraph cluster name.
    export NEBULA_CLUSTER_NAMESPACE=nebula    # The desired namespace where your NebulaGraph cluster locates.
    export STORAGE_CLASS_NAME=fast-disks             # The name of the StorageClass that has been created.
    
  4. Create a namespace for your NebulaGraph cluster (If you have created one, skip this step).

    kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
    
  5. Create a Secret for pulling the NebulaGraph cluster image from a private repository.

    kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" create secret docker-registry <image-pull-secret> \
    --docker-server=DOCKER_REGISTRY_SERVER \
    --docker-username=DOCKER_USER \
    --docker-password=DOCKER_PASSWORD
    
    • <image-pull-secret>: Specify the name of the Secret.
    • DOCKER_REGISTRY_SERVER: Specify the server address of the private repository from which the image will be pulled, such as reg.example-inc.com.
    • DOCKER_USER: The username for the image repository.
    • DOCKER_PASSWORD: The password for the image repository.
  6. Apply the variables to the Helm chart to create a NebulaGraph cluster.

    helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \
        # Configure the access address and port (default port is '9119') that points to the LM. You must configure this parameter in order to obtain the license information. Only for NebulaGraph Enterprise Edition clusters.
        --set nebula.metad.licenseManagerURL="192.168.8.XXX:9119" \
        # Configure the image addresses for each service in the cluster.
        --set nebula.graphd.image="<reg.example-inc.com/test/graphd-ent>" \
        --set nebula.metad.image="<reg.example-inc.com/test/metad-ent>" \
        --set nebula.storaged.image="<reg.example-inc.com/test/storaged-ent>" \
        # Configure the Secret for pulling images from a private repository.
        --set imagePullSecrets[0].name="{<image-pull-secret>}" \
        --set nameOverride="${NEBULA_CLUSTER_NAME}" \
        --set nebula.storageClassName="${STORAGE_CLASS_NAME}" \
        # Specify the version of the NebulaGraph cluster. 
        --set nebula.version=v3.5.0 \  
        # Specify the version of the nebula-cluster chart. If not specified, the latest version of the chart is installed by default.
        # Run 'helm search repo nebula-operator/nebula-cluster' to view the available versions of the chart.     
        --version=1.8.0 \
        --namespace="${NEBULA_CLUSTER_NAMESPACE}" \
    

    NebulaGraph Operator supports creating clusters with zones. For more information, see Install NebulaGraph clusters.

Create a NebulaGraph cluster with Kubectl

Legacy version compatibility

The 1.x version NebulaGraph Operator is not compatible with NebulaGraph of version below v3.x.

The following example shows how to create a NebulaGraph cluster by creating a cluster named nebula.

  1. Create a namespace, for example, nebula. If not specified, the default namespace is used.

    kubectl create namespace nebula
    
  2. Create a Secret for pulling the NebulaGraph Enterprise image from a private repository.

    kubectl -n <nebula> create secret docker-registry <image-pull-secret> \
    --docker-server=DOCKER_REGISTRY_SERVER \
    --docker-username=DOCKER_USER \
    --docker-password=DOCKER_PASSWORD
    
    • <nebula>: The namespace where this Secret will be stored.
    • <image-pull-secret>: Specify the name of the Secret.
    • DOCKER_REGISTRY_SERVER: Specify the server address of the private repository from which the image will be pulled, such as reg.example-inc.com.
    • DOCKER_USER: The username for the image repository.
    • DOCKER_PASSWORD: The password for the image repository.
  3. Define the cluster configuration file.

    Expand to see an example configuration for the cluster
    apiVersion: apps.nebula-graph.io/v1alpha1
    kind: NebulaCluster
    metadata:
      name: nebula
      namespace: default
    spec:
      topologySpreadConstraints:
      - topologyKey: "kubernetes.io/hostname"
        whenUnsatisfiable: "ScheduleAnyway"
      graphd:
        # Container image for the Graph service.
        image: reg.example-inc.com/xxx/xxx
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          # Storage class name for storing Graph service logs.
          storageClassName: local-sc
        replicas: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v3.5.0
      imagePullPolicy: Always
      # Secret for pulling images from a private repository.
      imagePullSecrets:
      - name: secret-name
      metad:
        # LM access address and port number for obtaining License information.
        licenseManagerURL: 192.168.x.xxx:9119
        # Container image for the Meta service.
        image: reg.example-inc.com/xxx/xxx
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: local-sc
        dataVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: local-sc
        replicas: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v3.5.0
      reference:
        name: statefulsets.apps
        version: v1
      schedulerName: default-scheduler
      storaged:
        # Container image for the Storage service.
        image: reg.example-inc.com/xxx/xxx
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: local-sc
        dataVolumeClaims:
        - resources:
            requests:
              storage: 2Gi
          storageClassName: local-sc
        replicas: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v3.5.0
    

    The following parameters must be customized:

    • spec.metad.licenseManagerURL: Configure the URL that points to the LM, which consists of the access address and port number (default port 9119) of the LM.
    • spec.<graphd|metad|storaged>.image: Specify the container image of the Graph, Meta, and Storage service respectively.
    • spec.imagePullSecrets: Specify the Secret for pulling the NebulaGraph Enterprise service images from a private repository.
    • spec.<graphd|metad|storaged>.logVolumeClaim.storageClassName: Specify the log disk storage configurations for the Graph, Meta, and Storage service respectively.
    • spec.metad.dataVolumeClaim.storageClassName: Specify the data disk storage configurations for the Meta service.
    • spec.storaged.dataVolumeClaims.storageClassName: Specify the data disk storage configurations for the Storage service.

    For more information about the other parameters, see Install NebulaGraph clusters.

  4. Create a NebulaGraph cluster.

    kubectl create -f apps_v1alpha1_nebulacluster.yaml
    

    Output:

    nebulacluster.apps.nebula-graph.io/nebula created
    
  5. Check the status of the NebulaGraph cluster.

    kubectl get nc nebula
    

    Output:

    NAME     READY     GRAPHD-DESIRED   GRAPHD-READY   METAD-DESIRED   METAD-READY   STORAGED-DESIRED   STORAGED-READY   AGE
    nebula    True     1                1              1               1             1                  1                86s
    

What's next

Connect to a cluster


Last update: November 22, 2023