Install a NebulaGraph cluster using NebulaGraph Operator¶
Using NebulaGraph Operator to install NebulaGraph clusters enables automated cluster management with automatic error recovery. This topic covers two methods, kubectl apply
and helm
, for installing clusters using NebulaGraph Operator.
Historical version compatibility
NebulaGraph Operator versions 1.x are not compatible with NebulaGraph versions below 3.x.
Prerequisites¶
Use kubectl apply
¶
-
Create a namespace for storing NebulaGraph cluster-related resources. For example, create the
nebula
namespace.kubectl create namespace nebula
-
Create a YAML configuration file
nebulacluster.yaml
for the cluster. For example, create a cluster namednebula
.Expand to view an example configuration for the
nebula
clusterapiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula namespace: default spec: # Control the Pod scheduling strategy. topologySpreadConstraints: - topologyKey: "kubernetes.io/hostname" whenUnsatisfiable: "ScheduleAnyway" # Enable PV recycling. enablePVReclaim: false # Enable monitoring. exporter: image: vesoft/nebula-stats-exporter version: v3.3.0 replicas: 1 maxRequests: 20 # Custom Agent image for cluster backup and restore, and log cleanup. agent: image: vesoft/nebula-agent version: latest resources: requests: cpu: "100m" memory: "128Mi" limits: cpu: "200m" memory: "256Mi" # Configure the image pull policy. imagePullPolicy: Always # Select the nodes for Pod scheduling. nodeSelector: nebula: cloud # Dependent controller name. reference: name: statefulsets.apps version: v1 # Scheduler name. schedulerName: default-scheduler # Start NebulaGraph Console service for connecting to the Graph service. console: image: vesoft/nebula-console version: nightly username: "demo" password: "test" # Graph service configuration. graphd: # Used to check if the Graph service is running normally. # readinessProbe: # failureThreshold: 3 # httpGet: # path: /status # port: 19669 # scheme: HTTP # initialDelaySeconds: 40 # periodSeconds: 10 # successThreshold: 1 # timeoutSeconds: 10 # 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 # Number of replicas for the Graph service Pod. replicas: 1 # Resource configuration for the Graph service. resources: limits: cpu: "1" memory: 1Gi requests: cpu: 500m memory: 500Mi # Version of the Graph service. version: v3.6.0 # Custom flags configuration for the Graph service. config: {} # Meta service configuration. metad: # readinessProbe: # failureThreshold: 3 # httpGet: # path: /status # port: 19559 # scheme: HTTP # initialDelaySeconds: 5 # periodSeconds: 5 # successThreshold: 1 # timeoutSeconds: 5 # 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.6.0 # Custom flags configuration for the Meta service. config: {} # Storage service configuration. storaged: # readinessProbe: # failureThreshold: 3 # httpGet: # path: /status # port: 19779 # scheme: HTTP # initialDelaySeconds: 40 # periodSeconds: 10 # successThreshold: 1 # timeoutSeconds: 5 # Container image for the Storage service. image: vesoft/nebula-graphd 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.6.0 # Custom flags configuration for the Storage service. config: {}
For more detailed information about these parameters, see the Cluster configuration parameters section below.
-
Create the NebulaGraph cluster.
kubectl create -f nebulacluster.yaml -n nebula
Output:
nebulacluster.apps.nebula-graph.io/nebula created
If you don't specify the namespace using
-n
, it will default to thedefault
namespace. -
Check the status of the NebulaGraph cluster.
kubectl get nebulaclusters nebula -n 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
Use helm
¶
-
Add the NebulaGraph Operator Helm repository (if it's already added, run the next step directly).
helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
-
Update the Helm repository to fetch the latest resources.
helm repo update nebula-operator
-
Set environment variables for the configuration parameters required for installing the cluster.
export NEBULA_CLUSTER_NAME=nebula # Name of the NebulaGraph cluster. export NEBULA_CLUSTER_NAMESPACE=nebula # Namespace for the NebulaGraph cluster. export STORAGE_CLASS_NAME=local-sc # StorageClass for the NebulaGraph cluster.
-
Create a namespace for the NebulaGraph cluster if it is not created.
kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
-
Check the customizable configuration parameters for the
nebula-cluster
Helm chart of thenebula-operator
when creating the cluster.-
Run the following command to view all the configurable parameters.
helm show values nebula-operator/nebula-cluster
- Visit nebula-cluster/values.yaml to see all the configuration parameters for the NebulaGraph cluster. Click on Chart parameters to see the parameter descriptions and their default values.
-
-
Create the NebulaGraph cluster.
You can use the
--set
flag to customize the default values of the NebulaGraph cluster configuration. For example,--set nebula.storaged.replicas=3
sets the number of replicas for the Storage service to 3.helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \ # Specify the version of the cluster chart. If not specified, it will install the latest version by default. # You can check all chart versions by running the command: helm search repo -l nebula-operator/nebula-cluster --version=1.7.3 \ # Specify the namespace for the NebulaGraph cluster. --namespace="${NEBULA_CLUSTER_NAMESPACE}" \ # Customize the cluster name. --set nameOverride="${NEBULA_CLUSTER_NAME}" \ --set nebula.storageClassName="${STORAGE_CLASS_NAME}" \ # Specify the version for the NebulaGraph cluster. --set nebula.version=v3.6.0
-
Check the status of NebulaGraph cluster pods.
kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" get pod -l "app.kubernetes.io/cluster=${NEBULA_CLUSTER_NAME}"
Output:
NAME READY STATUS RESTARTS AGE nebula-exporter-854c76989c-mp725 1/1 Running 0 14h nebula-graphd-0 1/1 Running 0 14h nebula-graphd-1 1/1 Running 0 14h nebula-metad-0 1/1 Running 0 14h nebula-metad-1 1/1 Running 0 14h nebula-metad-2 1/1 Running 0 14h nebula-storaged-0 1/1 Running 0 14h nebula-storaged-1 1/1 Running 0 14h nebula-storaged-2 1/1 Running 0 14h
Cluster configuration parameters¶
The table below lists the configurable parameters and their descriptions for creating a NebulaGraph cluster using a YAML file.
Parameter | Default Value | Description |
---|---|---|
metadata.name |
- | The name of the created NebulaGraph cluster. |
spec.console |
- | Launches a Console container for connecting to the Graph service. For configuration details, see nebula-console. |
spec.topologySpreadConstraints |
- | Controls the scheduling strategy for Pods. For more details, see Topology Spread Constraints. When the value of topologyKey is kubernetes.io/zone , the value of whenUnsatisfiable must be set to DoNotSchedule , and the value of spec.schedulerName should be nebula-scheduler . |
spec.graphd.replicas |
1 |
The number of replicas for the Graphd service. |
spec.graphd.image |
vesoft/nebula-graphd |
The container image for the Graphd service. |
spec.graphd.version |
v3.6.0 |
The version of the Graphd service. |
spec.graphd.service |
Configuration for accessing the Graphd service via a Service. | |
spec.graphd.logVolumeClaim.storageClassName |
- | The storage class name for the log volume claim of the Graphd service. When using sample configuration, replace it with the name of the pre-created storage class. See Storage Classes for creating a storage class. |
spec.metad.replicas |
1 |
The number of replicas for the Metad service. |
spec.metad.image |
vesoft/nebula-metad |
The container image for the Metad service. |
spec.metad.version |
v3.6.0 |
The version of the Metad service. |
spec.metad.dataVolumeClaim.storageClassName |
- | Storage configuration for the data disk of the Metad service. When using sample configuration, replace it with the name of the pre-created storage class. See Storage Classes for creating a storage class. |
spec.metad.logVolumeClaim.storageClassName |
- | Storage configuration for the log disk of the Metad service. When using sample configuration, replace it with the name of the pre-created storage class. See Storage Classes for creating a storage class. |
spec.storaged.replicas |
3 |
The number of replicas for the Storaged service. |
spec.storaged.image |
vesoft/nebula-storaged |
The container image for the Storaged service. |
spec.storaged.version |
v3.6.0 |
The version of the Storaged service. |
spec.storaged.dataVolumeClaims.resources.requests.storage |
- | The storage size for the data disk of the Storaged service. You can specify multiple data disks. When specifying multiple data disks, the paths are like /usr/local/nebula/data1 , /usr/local/nebula/data2 , and so on. |
spec.storaged.dataVolumeClaims.storageClassName |
- | Storage configuration for the data disks of the Storaged service. When using sample configuration, replace it with the name of the pre-created storage class. See Storage Classes for creating a storage class. |
spec.storaged.logVolumeClaim.storageClassName |
- | Storage configuration for the log disk of the Storaged service. When using sample configuration, replace it with the name of the pre-created storage class. See Storage Classes for creating a storage class. |
spec.<metad|storaged|graphd>.securityContext |
{} |
Defines the permission and access control for the cluster containers to control access and execution of container operations. For details, see SecurityContext. |
spec.agent |
{} |
Configuration for the Agent service used for backup and recovery, and log cleaning functions. If you don't customize this configuration, the default configuration is used. |
spec.reference.name |
{} |
The name of the controller it depends on. |
spec.schedulerName |
default-scheduler |
The name of the scheduler. |
spec.imagePullPolicy |
Always |
The image pull policy for NebulaGraph images. For more details on pull policies, please see Image pull policy. |
spec.logRotate |
{} |
Log rotation configuration. For details, see Managing Cluster Logs. |
spec.enablePVReclaim |
false |
Defines whether to automatically delete PVCs after deleting the cluster to release data. For details, see Reclaim PV. |