Deploy NebulaGraph clusters with Kubectl¶
Legacy version compatibility
The 1.x version Nebula Operator is not compatible with NebulaGraph of version below v3.x.
Prerequisites¶
- Install Nebula Operator
-
You have prepared the license file for NebulaGraph Enterprise Edition clusters.
Enterpriseonly
The license file is required only when creating a NebulaGraph Enterprise Edition cluster.
Create clusters¶
The following example shows how to create a NebulaGraph cluster by creating a cluster named nebula
.
-
Create a file named
apps_v1alpha1_nebulacluster.yaml
.The file contents 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.1.3 service: type: NodePort externalTrafficPolicy: Local logVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 metad: resources: requests: cpu: "500m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-metad version: v3.1.3 dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 logVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 storaged: resources: requests: cpu: "500m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 3 image: vesoft/nebula-storaged version: v3.1.3 dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 logVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 reference: name: statefulsets.apps version: v1 schedulerName: default-scheduler imagePullPolicy: Always
# Contact our sales team to get a complete NebulaGraph Enterprise Edition cluster YAML example. apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: annotations: nebula-graph.io/owner: test name: nebula spec: enablePVReclaim: true graphd: readinessProbe: failureThreshold: 3 httpGet: path: /status port: 19669 scheme: HTTP initialDelaySeconds: 40 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 10 image: reg.vesoft-inc.com/vesoft-ent/nebula-graphd logVolumeClaim: resources: requests: storage: 2Gi storageClassName: fast-disks replicas: 1 resources: limits: cpu: "1" memory: 1Gi requests: cpu: 500m memory: 500Mi version: v3.1.3 imagePullPolicy: Always imagePullSecrets: - name: vesoft metad: license: secretName: nebula-license licenseKey: nebula.license readinessProbe: failureThreshold: 3 httpGet: path: /status port: 19559 scheme: HTTP initialDelaySeconds: 5 periodSeconds: 5 successThreshold: 1 timeoutSeconds: 5 image: reg.vesoft-inc.com/vesoft-ent/nebula-metad logVolumeClaim: resources: requests: storage: 2Gi storageClassName: fast-disks dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: fast-disks replicas: 1 resources: limits: cpu: "1" memory: 1Gi requests: cpu: 500m memory: 500Mi version: v3.1.3 reference: name: statefulsets.apps version: v1 schedulerName: default-scheduler storaged: readinessProbe: failureThreshold: 3 httpGet: path: /status port: 19779 scheme: HTTP initialDelaySeconds: 40 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 image: reg.vesoft-inc.com/vesoft-ent/nebula-storaged logVolumeClaim: resources: requests: storage: 2Gi storageClassName: fast-disks dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: fast-disks replicas: 3 resources: limits: cpu: "1" memory: 1Gi requests: cpu: 500m memory: 500Mi version: v3.1.3 enableAutoBalance: true
The parameters in the file are described as follows:
Parameter Default value Description metadata.name
- The name of the created NebulaGraph cluster. spec.graphd.replicas
1
The numeric value of replicas of the Graphd service. spec.graphd.images
vesoft/nebula-graphd
The container image of the Graphd service. spec.graphd.version
v3.1.3
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.images
vesoft/nebula-metad
The container image of the Metad service. spec.metad.version
v3.1.3
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.images
vesoft/nebula-storaged
The container image of the Storaged service. spec.storaged.version
v3.1.3
The version of the Storaged service. spec.storaged.dataVolumeClaim.storageClassName
- The data disk storage configurations for the Storaged service. spec.storaged.logVolumeClaim.storageClassName
- The log disk storage configurations for the Storaged service. 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.metad.license
- The configuration of the license for creating a NebulaGraph Enterprise Edition cluster. Enterpriseonly
Make sure that you have access to NebulaGraph Enterprise Edition images before pulling the image. For details, contact our sales team (inqury@vesoft.com)
-
Create a NebulaGraph cluster.
kubectl create -f apps_v1alpha1_nebulacluster.yaml
Output:
nebulacluster.apps.nebula-graph.io/nebula created
-
Configure the license for the Enterprise Edition cluster.
Enterpriseonly
- This step is required only for creating a Nebula Grpah Enterprise Edition cluster.
- Ignore this step if you are creating a NebulaGraph Community Edition cluster.
kubectl create secret generic nebula-license --from-file=nebula.license
To check the details of the license, run the following command:
kubectl get secrets nebula-license -o yaml
-
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¶
Enterpriseonly
- The cluster scaling feature is for NebulaGraph Enterprise Edition only.
- Scaling a NebulaGraph cluster for Enterprise Edition is supported only with Nebula Operator version 1.1.0 or later.
You can modify the value of replicas
in apps_v1alpha1_nebulacluster.yaml
to scale a NebulaGraph cluster.
Scale out clusters¶
The following shows how to scale out a NebulaGraph cluster by changing the number of Storage services to 5:
-
Change the value of the
storaged.replicas
from3
to5
inapps_v1alpha1_nebulacluster.yaml
.storaged: resources: requests: cpu: "500m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 5 image: vesoft/nebula-storaged version: v3.1.3 dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 logVolumeClaim: resources: requests: storage: 2Gi storageClassName: gp2 reference: name: statefulsets.apps version: v1 schedulerName: default-scheduler
-
Run the following command to update the NebulaGraph cluster CR.
kubectl apply -f apps_v1alpha1_nebulacluster.yaml
-
Check the number of Storage services.
kubectl get pods -l app.kubernetes.io/cluster=nebula
Output:
NAME READY STATUS RESTARTS AGE nebula-graphd-0 1/1 Running 0 2m nebula-metad-0 1/1 Running 0 2m nebula-storaged-0 1/1 Running 0 2m nebula-storaged-1 1/1 Running 0 2m nebula-storaged-2 1/1 Running 0 2m nebula-storaged-3 1/1 Running 0 5m nebula-storaged-4 1/1 Running 0 5m
As you can see above, the number of Storage services is scaled up to 5.
Scale in clusters¶
The principle of scaling in a cluster is the same as scaling out a cluster. You scale in a cluster if the numeric value of the replicas
in apps_v1alpha1_nebulacluster.yaml
is changed smaller than the current number. For more information, see the Scale out clusters section above.
Caution
Nebula Operator currently only supports scaling Graph and Storage services and does not support scale Meta services.
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