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

    • The file contents for a NebulaGraph Community cluster are as follows:

      apiVersion: apps.nebula-graph.io/v1alpha1
      kind: NebulaCluster
      metadata:
        name: nebula
      spec:
        graphd:
          resources:
            requests:
              cpu: "500m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-graphd
          version: v3.3.0
          logVolumeClaim:
            resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
        metad:
          resources:
            requests:
              cpu: "500m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-metad
          version: v3.3.0
          logVolumeClaim:
            resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
          dataVolumeClaim:
            resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
        storaged:
          resources:
            requests:
              cpu: "500m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-storaged
          version: v3.3.0
          logVolumeClaim:
            resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
          dataVolumeClaims:  // You can mount multiple disks starting from NebulaGraph Operator 1.3.0.
          - resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
          - resources:
              requests:
                storage: 2Gi
            storageClassName: fast-disks
          enableAutoBalance: true
        reference:
          name: statefulsets.apps
          version: v1
        schedulerName: default-scheduler
        nodeSelector:
          nebula: cloud
        imagePullPolicy: Always
        unsatisfiableAction: ScheduleAnyway    
      
  2. Create a NebulaGraph cluster.

    kubectl create -f apps_v1alpha1_nebulacluster.yaml
    

    Output:

    nebulacluster.apps.nebula-graph.io/nebula created
    
  3. 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: February 19, 2024