Skip to main content
Version: 3.10.0

Create a NebulaGraph cluster

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

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

Prerequisites

Create a NebulaGraph Database cluster with Helm

:::compatibility 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
  1. Update information of available charts locally from chart repositories.
helm repo update
  1. 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.
  1. Create a namespace for your NebulaGraph cluster (If you have created one, skip this step).
kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
  1. 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=v<Var name="nebula_release" /> \
# 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 Database cluster with Kubectl

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

??? info "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: v<Var name="nebula_release" />
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: v<Var name="nebula_release" />
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: v<Var name="nebula_release" />

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

  1. Create a NebulaGraph cluster.
kubectl create -f nebulacluster.yaml

Output:

nebulacluster.apps.nebula-graph.io/nebula created
  1. 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