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.
-
Add the NebulaGraph Operator Helm repository.
helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
-
Update information of available charts locally from chart repositories.
helm repo update
-
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.
-
Create a namespace for your NebulaGraph cluster (If you have created one, skip this step).
kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
-
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=v3.8.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}" \
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
.
-
Create a namespace, for example,
nebula
. If not specified, thedefault
namespace is used.kubectl create namespace nebula
-
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: v3.8.0 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: v3.8.0 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: v3.8.0
For more information about the other parameters, see Install NebulaGraph clusters.
-
Create a NebulaGraph cluster.
kubectl create -f nebulacluster.yaml
Output:
nebulacluster.apps.nebula-graph.io/nebula created
-
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