Skip to content

Deploy NebulaGraph clusters with Kubectl

Legacy version compatibility

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

Prerequisites

Create clusters

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 file named apps_v1alpha1_nebulacluster.yaml.

    • For a NebulaGraph Community cluster

      For the file content, see the sample configuration.

      Expand to show sample parameter descriptions
      Parameter Default value Description
      metadata.name - The name of the created NebulaGraph cluster.
      spec.console - Configuration of the Console service. For details, see nebula-console.
      spec.graphd.replicas 1 The numeric value of replicas of the Graphd service.
      spec.graphd.image vesoft/nebula-graphd The container image of the Graphd service.
      spec.graphd.version v3.6.0 The version of the Graphd service.
      spec.graphd.service - The Service configurations for the Graphd service.
      spec.graphd.logVolumeClaim.storageClassName - The log disk storage configurations for the Graphd service.
      spec.metad.replicas 1 The numeric value of replicas of the Metad service.
      spec.metad.image vesoft/nebula-metad The container image of the Metad service.
      spec.metad.version v3.6.0 The version of the Metad service.
      spec.metad.dataVolumeClaim.storageClassName - The data disk storage configurations for the Metad service.
      spec.metad.logVolumeClaim.storageClassName - The log disk storage configurations for the Metad service.
      spec.storaged.replicas 3 The numeric value of replicas of the Storaged service.
      spec.storaged.image vesoft/nebula-storaged The container image of the Storaged service.
      spec.storaged.version v3.6.0 The version of the Storaged service.
      spec.storaged.dataVolumeClaims.resources.requests.storage - Data disk storage size for the Storaged service. You can specify multiple data disks to store data. When multiple disks are specified, the storage path is /usr/local/nebula/data1, /usr/local/nebula/data2, etc.
      spec.storaged.dataVolumeClaims.resources.storageClassName - The data disk storage configurations for Storaged. If not specified, the global storage parameter is applied.
      spec.storaged.logVolumeClaim.storageClassName - The log disk storage configurations for the Storaged service.
      spec.storaged.enableAutoBalance true Whether to balance data automatically.
      spec.agent {} Configuration of the Agent service. This is used for backup and recovery as well as log cleanup functions. If you do not customize this configuration, the default configuration will be used.
      spec.reference.name - The name of the dependent controller.
      spec.schedulerName - The scheduler name.
      spec.imagePullPolicy The image policy to pull the NebulaGraph image. For details, see Image pull policy. The image pull policy in Kubernetes.
      spec.logRotate - Log rotation configuration. For more information, see Manage cluster logs.
      spec.enablePVReclaim false Define whether to automatically delete PVCs and release data after deleting the cluster. For more information, see Reclaim PVs.
  3. Create a NebulaGraph cluster.

    kubectl create -f apps_v1alpha1_nebulacluster.yaml
    

    Output:

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

    kubectl get nebulaclusters.apps.nebula-graph.io nebula
    

    Output:

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

Scaling clusters

  • The cluster scaling feature is for NebulaGraph Enterprise Edition only.

-->

Delete clusters

Run the following command to delete a NebulaGraph cluster with Kubectl:

kubectl delete -f apps_v1alpha1_nebulacluster.yaml

What's next

Connect to NebulaGraph databases


Last update: September 20, 2023