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. Apply the variables to the Helm chart to create a NebulaGraph cluster.

    helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \
        --set nameOverride="${NEBULA_CLUSTER_NAME}" \
        --set nebula.storageClassName="${STORAGE_CLASS_NAME}" \
        # Specify the version of the NebulaGraph cluster. 
        --set nebula.version=vmaster \  
        # 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}" \
    

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. Define the cluster configuration file nebulacluster.yaml.

    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: vesoft/nebula-graphd
        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: vmaster
      imagePullPolicy: Always
      metad:
        # Container image for the Meta service.
        image: vesoft/nebula-metad
        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: vmaster
      reference:
        name: statefulsets.apps
        version: v1
      schedulerName: default-scheduler
      storaged:
        # Container image for the Storage service.
        image: vesoft/nebula-storaged
        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: vmaster
    

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

  3. Create a NebulaGraph cluster.

    kubectl create -f nebulacluster.yaml
    

    Output:

    nebulacluster.apps.nebula-graph.io/nebula created
    
  4. 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: January 30, 2024