### Show Nebula Operator Helm Chart Values Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/operator_guide.md Displays all configurable options for the Nebula Operator Helm chart with detailed comments. This command is useful for understanding customization possibilities before installation. It fetches information directly from the repository. ```shell helm show values nebula-operator/nebula-operator ``` -------------------------------- ### Install NebulaGraph Cluster with Helm Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/nebula_cluster_guide.md Installs a NebulaGraph cluster using the previously added Helm chart. It requires setting environment variables for the cluster name, namespace, and storage class. The command then creates the namespace if it doesn't exist and installs the cluster, followed by a check for running pods. ```shell export NEBULA_CLUSTER_NAME=nebula # the name for nebula cluster export NEBULA_CLUSTER_NAMESPACE=nebula # the namespace you want to install the nebula cluster export STORAGE_CLASS_NAME=gp2 # the storage class for the nebula cluster $ kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}" # If you have already created it, please skip. $ helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \ --namespace="${NEBULA_CLUSTER_NAMESPACE}" \ --set nameOverride=${NEBULA_CLUSTER_NAME} \ --set nebula.storageClassName="${STORAGE_CLASS_NAME}" # Please wait a while for the cluster to be ready. $ kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" get pod -l "app.kubernetes.io/cluster=${NEBULA_CLUSTER_NAME}" ``` -------------------------------- ### Manage NebulaGraph with kubectl and Helm Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt These bash commands demonstrate how to manage NebulaGraph clusters using kubectl for interacting with custom resources and Helm for installation and upgrades. It covers creating autoscalers, monitoring cluster status, installing, upgrading, and uninstalling NebulaGraph clusters and the operator itself. ```bash # Create autoscaler kubectl apply -f autoscaler.yaml # Monitor autoscaling activity kubectl get nebulaautoscaler nebula-autoscaler -w # Check current scaling status kubectl get nebulaautoscaler nebula-autoscaler -o jsonpath='{.status}' # View autoscaler conditions kubectl describe nebulaautoscaler nebula-autoscaler # Generate load to trigger scale up # Monitor pod count changes kubectl get pods -l app.kubernetes.io/cluster=nebula,app.kubernetes.io/component=graphd -w ``` ```bash # Add nebula-operator helm repository helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts helm repo update # Install nebula-operator helm install nebula-operator nebula-operator/nebula-operator \ --namespace nebula-operator-system \ --create-namespace \ --set image.nebulaOperator.version=v1.8.6 # Verify operator installation kubectl get pods -n nebula-operator-system # Install nebula cluster via helm helm install nebula-cluster nebula-operator/nebula-cluster \ --namespace nebula \ --create-namespace \ --set nebula.version=v3.6.0 \ --set nebula.storageClassName=standard \ --set nebula.graphd.replicas=2 \ --set nebula.metad.replicas=3 \ --set nebula.storaged.replicas=3 \ --set nebula.storaged.enableAutoBalance=true # Check cluster status helm status nebula-cluster -n nebula kubectl get nebulacluster -n nebula # Upgrade cluster configuration helm upgrade nebula-cluster nebula-operator/nebula-cluster \ --namespace nebula \ --set nebula.graphd.replicas=4 \ --reuse-values # Uninstall cluster helm uninstall nebula-cluster -n nebula helm uninstall nebula-operator -n nebula-operator-system ``` -------------------------------- ### Install Nebula Operator using Helm Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/operator_guide.md Installs the Nebula Operator in a specified Kubernetes namespace using Helm. It requires a chart version and optionally allows specifying a name for the Helm release. The command assumes the target namespace is pre-created. ```shell # helm install [NAME] [CHART] [flags] helm install nebula-operator nebula-operator/nebula-operator --namespace=nebula-operator-system --version=${chart_version} ``` -------------------------------- ### Add Helm Repository for Nebula Operator Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/operator_guide.md Adds the Nebula Operator Helm repository to your Helm configuration. This is a prerequisite for installing the operator using Helm. It fetches the latest chart information. ```shell helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts helm repo update ``` -------------------------------- ### Manage NebulaGraph Cron Backups with kubectl Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/br_guide.md These shell commands demonstrate how to apply a cron backup configuration and then query the status of NebulaCronBackup resources and the resulting NebulaBackup objects. `kubectl apply` creates the cron backup job, `kubectl get ncb` lists all cron backup resources and their scheduling status, and `kubectl get nb` lists individual backup jobs associated with a specific cron backup. ```shell $ kubectl apply -f cronjob.yaml $ kubectl get ncb NAME SCHEDULE LASTBACKUP LASTSCHEDULETIME LASTSUCCESSFULTIME BACKUPCLEANTIME AGE cron123 */5 * * * * cron123-20240228t102500 2m40s 64s 54s 45m $ kubectl get nb -l "apps.nebula-graph.io/cron-backup=cron123" NAME TYPE BACKUP STATUS STARTED COMPLETED AGE cron123-20240228t094500 full BACKUP_2024_02_28_09_45_01 Complete 42m 41m 42m cron123-20240228t102500 full BACKUP_2024_02_28_10_26_08 Complete 85s 55s 85s ``` -------------------------------- ### Manage NebulaGraph Restores with kubectl Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/br_guide.md These shell commands illustrate how to apply a NebulaRestore configuration and verify the restore process. `kubectl apply` initiates the restore operation defined in the YAML file. `kubectl get nr` lists the NebulaRestore resources and their status, showing if the restore is complete. `kubectl get nc` displays the status of NebulaGraph clusters, including the newly restored one. ```shell $ kubectl apply -f nebularestore-s3.yaml $ kubectl get nr nr2048 NAME STATUS RESTORED-CLUSTER STARTED COMPLETED AGE nr2048 Complete ng6tdt 14m 6m55s 14m $ kubectl get nc NAME READY GRAPHD-DESIRED GRAPHD-READY METAD-DESIRED METAD-READY STORAGED-DESIRED STORAGED-READY AGE nebula True 1 1 3 3 3 3 45m ng6tdt True 1 1 3 3 3 3 10m ``` -------------------------------- ### Cluster Deployment and Management (kubectl) Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt Provides kubectl commands for deploying, verifying, monitoring, and deleting NebulaGraph clusters managed by the Nebula Operator. It includes examples for creating clusters, checking pod status, and accessing the Nebula console. ```APIDOC ## Cluster Deployment and Management ### Description This section details how to deploy, manage, and delete NebulaGraph clusters using `kubectl` commands. It covers creating a cluster from a sample configuration, verifying its status, and cleaning up resources. ### Method `kubectl` commands (CREATE, GET, DELETE) ### Endpoint N/A (Applies to Kubernetes resources managed by the operator) ### Parameters N/A ### Request Example ```bash # Create a new NebulaGraph cluster kubectl create -f config/samples/nebulacluster.yaml # Verify cluster pods are running kubectl get pods -l app.kubernetes.io/cluster=nebula # Expected output: # NAME READY STATUS RESTARTS AGE # nebula-graphd-0 1/1 Running 0 1m # nebula-metad-0 1/1 Running 0 1m # nebula-storaged-0 1/1 Running 0 1m # nebula-storaged-1 1/1 Running 0 1m # nebula-storaged-2 1/1 Running 0 1m # Check cluster status and component readiness kubectl get nebulacluster nebula -o wide # Access nebula console via service (assuming a NodePort service is created) # kubectl create -f config/samples/graphd-nodeport-service.yaml # nebula-console -u user -p password --address= --port= # Delete the cluster kubectl delete -f config/samples/nebulacluster.yaml ``` ### Response #### Success Response Output from `kubectl` commands indicating the status of operations (e.g., pod status, cluster status). #### Response Example ``` # Example for 'kubectl get pods': # NAME READY STATUS RESTARTS AGE # nebula-graphd-0 1/1 Running 0 5m # nebula-metad-0 1/1 Running 0 5m # nebula-storaged-0 1/1 Running 0 5m # nebula-storaged-1 1/1 Running 0 5m # nebula-storaged-2 1/1 Running 0 5m ``` ``` -------------------------------- ### Apply and Verify SSL-Enabled NebulaGraph Cluster Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt Applies the SSL-enabled NebulaGraph cluster configuration using kubectl and verifies the SSL setup by checking the server certificate. It also shows how to connect to the cluster using the nebula-console with SSL enabled. ```bash # Apply SSL-enabled cluster kubectl apply -f ssl-cluster.yaml # Verify SSL configuration kubectl exec -it nebula-graphd-0 -- cat /usr/local/nebula/certs/server.crt # Connect with SSL nebula-console -u user -p password \ --address= --port= \ --enable_ssl \ --ssl_root_ca_path=/path/to/ca.crt \ --ssl_cert_path=/path/to/client.crt \ --ssl_private_key_path=/path/to/client.key ``` -------------------------------- ### Add Nebula Operator Helm Repository Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/nebula_cluster_guide.md Adds the nebula-operator Helm repository to your local configuration. This step is necessary to fetch the NebulaGraph cluster Helm chart. Ensure you have Helm installed and configured. ```shell # If you have already added it, please skip. $ helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts $ helm repo update ``` -------------------------------- ### Define Init-Container for Certificate Copying Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/ssl_guide.md This YAML configuration defines an init-container that copies certificates from a mounted volume ('/certs') to a shared directory ('/credentials'). This init-container ensures that certificates are available in the correct location before the main controller-manager container starts. ```yaml extraInitContainers: - name: init-auth-sidecar command: - /bin/sh - -c args: - cp -R /certs/* /credentials/ imagePullPolicy: Always image: reg.vesoft-inc.com/cloud-dev/nebula-certs:latest volumeMounts: - name: credentials mountPath: /credentials ``` -------------------------------- ### Run Default E2E Tests with Kind Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Executes the default end-to-end tests using Kind (Kubernetes in Docker). Requires setting the E2E_DOCKER_CONFIG_JSON_SECRET environment variable with your Docker config and E2E_OPERATOR_IMAGE with your Nebula Operator image. It then runs 'make e2e'. ```shell export E2E_DOCKER_CONFIG_JSON_SECRET=`cat ~/.docker/config.json| base64 -w 0` export E2E_OPERATOR_IMAGE= # your own nebula-operator image make e2e ``` -------------------------------- ### Run Enterprise Edition E2E Tests Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Configures and runs end-to-end tests for the Nebula Graph enterprise edition. Requires setting Docker configuration, disabling operator installation if pre-existing, and specifying Nebula components' image URIs and license manager URL. Uses 'make e2e' with E2EARGS. ```shell export E2E_DOCKER_CONFIG_JSON_SECRET=`cat ~/.docker/config.json| base64 -w 0` export E2E_OPERATOR_INSTALL=false # if you already install nebula-operator export E2E_NC_VERSION=v3.5.1 # if you want to specify version export E2E_NC_GRAPHD_IMAGE=reg.vesoft-inc.com/vesoft-ent/nebula-graphd-ent export E2E_NC_METAD_IMAGE=reg.vesoft-inc.com/vesoft-ent/nebula-metad-ent export E2E_NC_STORAGED_IMAGE=reg.vesoft-inc.com/vesoft-ent/nebula-storaged-ent export E2E_NC_LICENSE_MANAGER_URL=license.vesoft-inc.com:9119 make e2e E2EARGS="--kubeconfig ~/.kube/config" ``` -------------------------------- ### NebulaGraph Cluster Scaling with Kubectl Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt Demonstrates how to apply scaling changes to a NebulaGraph cluster on Kubernetes using kubectl and monitor the process. After modifying the NebulaCluster CRD (e.g., changing replica counts), 'kubectl apply' is used to enact the changes, and 'kubectl get pods -w' monitors the pod lifecycle events. ```bash # Apply the scaling change kubectl apply -f config/samples/nebulacluster.yaml # Monitor scaling progress kubectl get pods -l app.kubernetes.io/cluster=nebula -w ``` -------------------------------- ### Filter E2E Tests by Labels Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Runs specific end-to-end test cases filtered by labels. The 'make e2e' command is used with E2EARGS, which includes the '--kubeconfig' flag and the '-labels' flag to specify comma-separated key-value pairs for filtering. ```shell make e2e E2EARGS="--kubeconfig ~/.kube/config -labels category=basic,group=scale" ``` -------------------------------- ### NebulaGraph Cluster Scaling with NebulaCluster CRD Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt Illustrates how to scale a NebulaGraph cluster by modifying the replica count for components within the NebulaCluster CRD. This example shows scaling the 'storaged' component from 3 to 5 replicas. Changes are applied using kubectl, and the scaling progress can be monitored. ```yaml apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula spec: storaged: replicas: 5 image: vesoft/nebula-storaged version: v3.6.0 enableAutoBalance: true dataVolumeClaims: - resources: requests: storage: 10Gi storageClassName: ebs-sc ``` -------------------------------- ### Manage NebulaRestore Operations (Bash) Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt These bash commands guide the process of restoring NebulaGraph data using the `NebulaRestore` custom resource. It includes stopping the cluster before the restore, applying the restore configuration, monitoring its progress, and finally restarting the cluster and verifying the restored data. ```bash # Stop cluster before restore kubectl scale nebulacluster nebula --replicas=0 # Create restore operation kubectl apply -f restore.yaml # Monitor restore progress kubectl get nebularestore nebula-restore -w # Check restore status kubectl describe nebularestore nebula-restore # Restart cluster after restore completes kubectl scale nebulacluster nebula --replicas=3 # Verify data restoration nebula-console -u user -p password --address= --port= ``` -------------------------------- ### Filter E2E Tests by Labels and Feature Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Combines label and feature filtering for end-to-end tests. The 'make e2e' command is executed with E2EARGS, specifying both '--kubeconfig', '-labels' for category and group, and '-feature' for a regular expression. ```shell make e2e E2EARGS="--kubeconfig ~/.kube/config -labels category=basic,group=scale -feature 'scale.*default'" ``` -------------------------------- ### Configure NebulaGraph Backup (YAML) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/br_guide.md This snippet demonstrates the YAML configuration for a NebulaBackup resource in Kubernetes. It specifies backup image details, resource allocation, image pull secrets, cleanup policies, and cloud storage configuration (GCS in this example) including bucket details and secret references for authentication. ```yaml apiVersion: v1 kind: Secret metadata: name: gcp-secret type: Opaque data: credentials: --- apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaBackup metadata: name: nb1024 spec: image: reg.vesoft-inc.com/cloud-dev/br-ent version: v3.7.0 resources: limits: cpu: "200m" memory: 300Mi requests: cpu: 100m memory: 200Mi imagePullSecrets: - name: nebula-image # The job that status is failed and completed will be removed automatically. autoRemoveFinished: true # CleanBackupData denotes whether to clean backup data when the object is deleted from the cluster, # if not set, the backup data will be retained cleanBackupData: true config: # The name of the backup/restore nebula cluster clusterName: nebula # Concurrency is used to control the number of concurrent file uploads during data backup. concurrency: 15 gs: # Location in which the gs bucket is located. location: "us-central1" # Bucket in which to store the backup data. bucket: "nebula-test" # SecretName is the name of secret which stores google application credentials. # Secret key: credentials secretName: "gcp-secret" ``` -------------------------------- ### NebulaBackup Custom Resource (YAML) Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt This YAML defines a `NebulaBackup` custom resource to create full or incremental backups of a NebulaGraph cluster. It specifies the backup image, version, resource requirements, cloud storage configuration (S3 in this example), and credentials via a Kubernetes Secret. ```yaml apiVersion: v1 kind: Secret metadata: name: aws-secret type: Opaque data: access_key: secret_key: --- apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaBackup metadata: name: nebula-backup-full spec: image: vesoft/nebula-br version: v3.6.0 resources: limits: cpu: "500m" memory: "500Mi" requests: cpu: "250m" memory: "250Mi" imagePullPolicy: Always cleanBackupData: false autoRemoveFinished: false config: clusterName: nebula concurrency: 5 s3: region: "us-west-2" bucket: "nebula-backups" endpoint: "https://s3.us-west-2.amazonaws.com" secretName: "aws-secret" ``` -------------------------------- ### Patch Nebula Cluster: HA Mode Configuration Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/webhook.md This example shows how to enable HA mode for a Nebula cluster using annotations and then attempts to set the graphd replicas to 1. The admission webhook rejects this, enforcing that 'spec.graphd.replicas' must be at least 2 in HA mode. ```shell # Create a nebula cluster with 2 graphd, 3 metad, and 3 storaged to meet the minimum HA configuration requirement. $ kubectl annotate nc nebula nebula-graph.io/ha-mode=true $ kubectl patch nc nebula --type='merge' --patch '{"spec": {"graphd": {"replicas":1}}}' ``` -------------------------------- ### Restart a Specific Storaged Pod with Ordinal Annotation Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/restart_cluster.md This command restarts a specific 'nebula-storaged' pod by annotating the StatefulSet with the pod's ordinal index. Storage service supports graceful restart, while Meta and Graph services can directly delete Pods. The example shows how to monitor the restart process and associated logs. ```shell # Triggers storaged-1 restart $ kubectl annotate sts nebula-storaged nebula-graph.io/restart-ordinal="1" statefulset.apps/nebula-storaged annotate # Watch logs I1112 14:39:37.934046 3170806 storage_client.go:86] start transfer leader spaceID 5 partitionID 45 I1112 14:39:42.938781 3170806 storaged_updater.go:389] storaged cluster [default/nebula-storaged] transfer leader spaceID 5 partitionID 45 to host nebula-storaged-3.nebula-storaged-headless.default.svc.cluster.local successfully I1112 14:39:42.938839 3170806 storage_client.go:86] start transfer leader spaceID 5 partitionID 42 I1112 14:39:47.941335 3170806 storaged_updater.go:389] storaged cluster [default/nebula-storaged] transfer leader spaceID 5 partitionID 42 to host nebula-storaged-0.nebula-storaged-headless.default.svc.cluster.local successfully I1112 14:39:47.941390 3170806 storage_client.go:86] start transfer leader spaceID 5 partitionID 40 I1112 14:39:52.943926 3170806 storaged_updater.go:389] storaged cluster [default/nebula-storaged] transfer leader spaceID 5 partitionID 40 to host nebula-storaged-0.nebula-storaged-headless.default.svc.cluster.local successfully I1112 14:39:52.943971 3170806 storage_client.go:86] start transfer leader spaceID 5 partitionID 34 I1112 14:39:57.946534 3170806 storaged_updater.go:389] storaged cluster [default/nebula-storaged] transfer leader spaceID 5 partitionID 34 to host nebula-storaged-4.nebula-storaged-headless.default.svc.cluster.local successfully I1112 14:39:57.946576 3170806 storage_client.go:86] start transfer leader spaceID 5 partitionID 31 I1112 14:40:02.949196 3170806 storaged_updater.go:389] storaged cluster [default/nebula-storaged] transfer leader spaceID 5 partitionID 31 to host nebula-storaged-0.nebula-storaged-headless.default.svc.cluster.local successfully # Watch restart event $ kubectl get pods -l app.kubernetes.io/cluster=nebula,app.kubernetes.io/component=storaged -w NAME READY STATUS RESTARTS AGE nebula-storaged-0 1/1 Running 0 13h nebula-storaged-1 1/1 Running 0 13h nebula-storaged-2 1/1 Running 0 13h nebula-storaged-3 1/1 Running 0 13h nebula-storaged-4 1/1 Running 0 13h nebula-storaged-5 1/1 Running 0 12h nebula-storaged-6 1/1 Running 0 12h nebula-storaged-7 1/1 Running 0 12h nebula-storaged-8 1/1 Running 0 12h nebula-storaged-1 1/1 Running 0 13h nebula-storaged-1 1/1 Terminating 0 13h nebula-storaged-1 0/1 Terminating 0 13h nebula-storaged-1 0/1 Terminating 0 13h nebula-storaged-1 0/1 Terminating 0 13h nebula-storaged-1 0/1 Terminating 0 13h nebula-storaged-1 0/1 Pending 0 0s nebula-storaged-1 0/1 Pending 0 0s nebula-storaged-1 0/1 ContainerCreating 0 0s nebula-storaged-1 0/1 Running 0 1s nebula-storaged-1 1/1 Running 0 10s ``` -------------------------------- ### Connect to NebulaGraph via Console (Shell) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/client_service.md This shell command demonstrates how to connect to a NebulaGraph service exposed via Nginx Ingress Controller using the nebula-console. It specifies the external IP address (192.168.8.25) and the configured external port (9669) from the ConfigMap, along with authentication credentials. This verifies the successful setup of the Nginx Ingress for TCP services. ```shell script / # nebula-console -addr 192.168.8.25 -port 9669 -u root -p nebula 2021/11/08 14:53:56 [INFO] connection pool is initialized successfully Welcome to NebulaGraph! (root@nebula) [(none)]> ``` -------------------------------- ### NebulaGraph Cluster Deployment with Kubectl Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt Demonstrates how to deploy a NebulaGraph cluster on Kubernetes using kubectl and manage its lifecycle. This includes creating a cluster from a YAML definition, verifying pod status, checking cluster status, accessing the console via a service, and deleting the cluster. Requires Kubernetes and kubectl to be configured. ```bash # Create a new NebulaGraph cluster kubectl create -f config/samples/nebulacluster.yaml # Verify cluster pods are running kubectl get pods -l app.kubernetes.io/cluster=nebula # Expected output: # NAME READY STATUS RESTARTS AGE # nebula-graphd-0 1/1 Running 0 1m # nebula-metad-0 1/1 Running 0 1m # nebula-storaged-0 1/1 Running 0 1m # nebula-storaged-1 1/1 Running 0 1m # nebula-storaged-2 1/1 Running 0 1m # Check cluster status and component readiness kubectl get nebulacluster nebula -o wide # Access nebula console via service kubectl create -f config/samples/graphd-nodeport-service.yaml nebula-console -u user -p password --address= --port= # Delete the cluster kubectl delete -f config/samples/nebulacluster.yaml ``` -------------------------------- ### Uninstall Nebula Operator and CRDs Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/operator_guide.md Uninstalls the Nebula Operator using Helm and removes the associated custom resource definitions (CRDs) from Kubernetes. This command ensures a clean removal of the operator and its managed resources. ```shell helm uninstall nebula-operator --namespace=nebula-operator-system kubectl delete crd nebulaclusters.apps.nebula-graph.io ``` -------------------------------- ### Run E2E Tests on Existing Kubernetes Cluster Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Runs end-to-end tests on an existing Kubernetes cluster. Set E2E_DOCKER_CONFIG_JSON_SECRET and E2E_OPERATOR_INSTALL to 'false' if the operator is already installed. The E2EARGS variable specifies the kubeconfig path. ```shell export E2E_DOCKER_CONFIG_JSON_SECRET=`cat ~/.docker/config.json| base64 -w 0` export E2E_OPERATOR_INSTALL=false # if you already install nebula-operator make e2e E2EARGS="--kubeconfig ~/.kube/config" ``` -------------------------------- ### Build and Develop Nebula Operator Components Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt This section outlines the process for building and developing the Nebula Operator from source code. It covers generating Kubernetes manifests, deepcopy functions, running code checks and tests, building operator binaries and Docker images, packaging Helm charts, and executing end-to-end tests, including cross-compilation for different platforms. ```bash # Generate CRDs and manifests make manifests # Generate deepcopy and default functions make generate # Run code checks and tests make check make test # Build all operator binaries make build-operator # Produces: # - bin/linux/amd64/controller-manager # - bin/linux/amd64/autoscaler # - bin/linux/amd64/scheduler # Build local PV provisioner make build-provisioner # Produces: bin/linux/amd64/local-pv-provisioner # Build Docker image export DOCKER_REGISTRY=docker.io export DOCKER_REPO=myrepo export IMAGE_TAG=v1.0.0 make docker-build # Push to registry make docker-push # Build helm charts export CHARTS_VERSION=1.0.0 make helm-charts # Run e2e tests make e2e E2EARGS="--focus=NebulaCluster" # Cross-compile for different platforms GOOS=darwin GOARCH=arm64 make build-operator ``` -------------------------------- ### Upgrade Nebula Operator using Helm Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/operator_guide.md Upgrades an existing Nebula Operator deployment managed by Helm. This involves modifying the local `values.yaml` file and then applying the changes using the `helm upgrade` command. It targets a specific namespace and uses the updated configuration. ```shell helm upgrade nebula-operator nebula-operator/nebula-operator --namespace=nebula-operator-system -f `${HOME}/nebula-operator/values.yaml` ``` -------------------------------- ### Create Nebula Cluster using kubectl Source: https://github.com/vesoft-inc/nebula-operator/blob/master/README.md This snippet demonstrates how to create a NebulaGraph cluster by applying a sample nebulacluster.yaml configuration file using kubectl. It shows the expected output of created pods. ```bash $ kubectl create -f config/samples/nebulacluster.yaml ... NAME READY STATUS RESTARTS AGE nebula-graphd-0 1/1 Running 0 1m nebula-metad-0 1/1 Running 0 1m nebula-storaged-0 1/1 Running 0 1m nebula-storaged-1 1/1 Running 0 1m nebula-storaged-2 1/1 Running 0 1m ``` -------------------------------- ### Access Nebula Cluster via NodePort Service Source: https://github.com/vesoft-inc/nebula-operator/blob/master/README.md This snippet shows how to expose a NebulaGraph cluster using a NodePort service and then connect to it using the nebula-console client. It assumes a local kubeadm setup. ```bash $ kubectl create -f config/samples/graphd-nodeport-service.yaml $ nebula-console -u user -p password --address=192.168.8.26 --port=32236 2021/04/15 16:50:23 [INFO] connection pool is initialized successfully Welcome to NebulaGraph! (user@nebula) [(none)]> ``` -------------------------------- ### Manage NebulaBackup Operations (Bash) Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt These bash commands are used to create, monitor, and inspect the status of NebulaGraph backups using the `NebulaBackup` custom resource. This includes applying the backup definition, watching its progress, and retrieving detailed status information. ```bash # Create the backup kubectl apply -f backup.yaml # Monitor backup progress kubectl get nebulabackup nebula-backup-full -w # Check backup status kubectl get nebulabackup nebula-backup-full -o jsonpath='{.status}' ``` -------------------------------- ### Uninstall NebulaGraph Cluster with Helm Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/nebula_cluster_guide.md Uninstalls a NebulaGraph cluster deployed using Helm. This command removes all resources associated with the specified cluster name and namespace. Ensure you have the correct cluster name and namespace before executing. ```shell $ helm uninstall "${NEBULA_CLUSTER_NAME}" --namespace="${NEBULA_CLUSTER_NAMESPACE}" ``` -------------------------------- ### Manage NebulaCronBackup Jobs (Bash) Source: https://context7.com/vesoft-inc/nebula-operator/llms.txt These bash commands manage scheduled backup jobs using `NebulaCronBackup`. They cover creating the cron job, listing all scheduled jobs, viewing the history of backups created by cron jobs, and describing the details of a specific cron backup job. ```bash # Create scheduled backup job kubectl apply -f cronbackup.yaml # List all cron backup jobs kubectl get nebulacronbackup # View backup history kubectl get nebulabackup # Check cron backup schedule status kubectl describe nebulacronbackup cronbackup ``` -------------------------------- ### Configure Cron Backup for NebulaGraph Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/br_guide.md This YAML configuration defines a NebulaCronBackup resource, which automates the creation of backups for a NebulaGraph cluster on a defined schedule. It specifies backup image, resource requirements, retention policies, and the storage location for backups. The `schedule` field uses cron format, and `maxReservedTime` controls how long backups are kept. `backupTemplate` defines the settings for each backup job, including `autoRemoveFinished` and `cleanBackupData` flags. ```yaml apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCronBackup metadata: name: cron123 spec: # The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron schedule: "*/5 * * * *" # MaxReservedTime is to specify how long backups we want to keep. # It should be a duration string format. maxReservedTime: 60m # Specifies the backup that will be created when executing a CronBackup. backupTemplate: image: reg.vesoft-inc.com/cloud-dev/br-ent version: v3.7.0 resources: limits: cpu: "200m" memory: 300Mi requests: cpu: 100m memory: 200Mi imagePullSecrets: - name: nebula-image autoRemoveFinished: true cleanBackupData: true config: clusterName: nebula concurrency: 15 gs: location: "us-central1" bucket: "nebula-test" secretName: "gcp-secret" ``` -------------------------------- ### Verify Persistent Volume Size After Expansion Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/pv_expansion.md These commands are used to verify that the Persistent Volume (PV) has been successfully expanded. The first command checks the PVC status, which may still show the original size. The second command directly queries the PV object to confirm the updated storage capacity. Replace `` and `` with your specific values. ```shell kubectl get pvc -n ``` ```shell kubectl get pv | grep ``` -------------------------------- ### Filter E2E Tests by Feature Regular Expression Source: https://github.com/vesoft-inc/nebula-operator/blob/master/tests/e2e/README.md Executes end-to-end tests that match a specified feature regular expression. The 'make e2e' command is utilized with E2EARGS, including '--kubeconfig' and the '-feature' flag followed by a regular expression pattern. ```shell make e2e E2EARGS="--kubeconfig ~/.kube/config -feature 'scale.*default'" ``` -------------------------------- ### Enable Volume Expansion in StorageClass Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/pv_expansion.md This command enables the volume expansion capability for a specific StorageClass. It requires administrative privileges to modify cluster resources. Ensure the StorageClass name (e.g., 'ebs-sc') is correct for your environment. ```shell kubectl patch storageclass ebs-sc -p '{"allowVolumeExpansion": true}' ``` -------------------------------- ### Define EmptyDir Volume for Certificate Sharing Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/ssl_guide.md This YAML snippet defines an 'emptyDir' volume named 'credentials' with 'Memory' medium. This volume is used to share certificates between the sidecar container and the controller-manager container within the same pod. ```yaml extraVolumes: - name: credentials emptyDir: medium: Memory ``` -------------------------------- ### Apply and Verify NebulaGraph Backup (Shell) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/br_guide.md This snippet shows the shell commands to apply a NebulaBackup configuration to a Kubernetes cluster and then retrieve the status of the backup job. It is useful for initiating and monitoring the backup process. ```shell $ kubectl apply -f nebulabackup-gs.yaml $ kubectl get nb nb1024 ``` -------------------------------- ### Upgrade NebulaGraph Cluster with Helm Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/nebula_cluster_guide.md Upgrades an existing NebulaGraph cluster deployed via Helm. This command allows modifying cluster configurations, such as increasing the number of storaged replicas. It also includes a verification step to check the status of pods after the upgrade. ```shell $ helm upgrade "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \ --namespace="${NEBULA_CLUSTER_NAMESPACE}" \ --set nameOverride=${NEBULA_CLUSTER_NAME} \ --set nebula.storageClassName="${STORAGE_CLASS_NAME}" \ --set nebula.storaged.replicas=5 # Please wait a while for the cluster to be ready. $ kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" get pod -l "app.kubernetes.io/cluster=${NEBULA_CLUSTER_NAME}" ``` -------------------------------- ### Recover Nebula Cluster using kubectl Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/suspend_cluster.md This command recovers a suspended NebulaGraph cluster by patching its `spec.suspend` field to `null`. This action resumes the cluster's operations and releases resources that were previously held. The recovery process can be monitored using `kubectl get nc nebula -w`. ```shell # Recovery cluster $ kubectl patch nc nebula --type='merge' --patch '{"spec": {"suspend":null}}' nebulacluster.apps.nebula-graph.io/nebula patched # Watch the status $ kubectl get nc nebula -w NAME READY GRAPHD-DESIRED GRAPHD-READY METAD-DESIRED METAD-READY STORAGED-DESIRED STORAGED-READY AGE nebula False 1 1 9 16h nebula False 1 1 9 16h nebula False 1 1 1 9 16h nebula False 1 1 1 9 16h nebula False 1 1 1 9 16h nebula False 1 1 1 9 16h nebula False 1 1 1 9 3 16h nebula False 1 1 1 9 4 16h nebula False 1 1 1 9 5 16h nebula False 1 1 1 9 6 16h nebula False 1 1 1 9 8 16h nebula False 1 1 1 1 9 8 16h nebula False 1 1 1 1 9 8 16h nebula False 1 1 1 1 9 8 16h nebula False 1 1 1 9 8 16h nebula False 1 1 1 9 8 16h nebula False 1 1 1 9 8 16h nebula False 1 1 1 9 8 16h nebula False 1 1 1 9 9 16h nebula True 1 1 1 1 9 9 16h ``` -------------------------------- ### Apply Custom Flags in NebulaCluster CRD (YAML) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/custom_config.md This YAML example demonstrates how to apply custom configuration flags like `enable_authorize`, `auth_type`, and `foo` to the graphd component within a NebulaCluster CRD. The `config` map directly translates to key-value pairs in the component's configuration. ```yaml apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula namespace: default spec: graphd: resources: requests: cpu: "500m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-graphd version: v3.6.0 storageClaim: resources: requests: storage: 2Gi storageClassName: ebs-sc config: "enable_authorize": "true" "auth_type": "password" "foo": "bar" ... ``` -------------------------------- ### Enable Admission Webhook (Helm Values) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/webhook.md Configures the Nebula Operator's admission webhook settings within the Helm chart's values.yaml file. This allows enabling the webhook for controller-manager and autoscaler components and specifies whether to use cert-manager or self-signed certificates. ```yaml # helm chart nebula-operator values.yaml, set `create` to true under `contollerManagerAdmissionWebhook` # to enable the webhook for the controller manager and under `autoscalerAdmissionWebhook` # to enable the webhook for the autoscaler. The two can be enabled both independently or together. admissionWebhook: contollerManagerAdmissionWebhook: create: true # The TCP port the Webhook server binds to. (default 9443) webhookBindPort: 9443 autoscalerAdmissionWebhook: create: true # The TCP port the Webhook server binds to. (default 9448) webhookBindPort: 9448 # set useCertManager to true to have the webhook server use the certificates # generated by cert-manager useCertManager: true ``` ```yaml # helm chart nebula-operator values.yaml, set `create` to true under `contollerManagerAdmissionWebhook` # to enable the webhook for the controller manager and under `autoscalerAdmissionWebhook` ``` -------------------------------- ### Enable Full SSL Encryption (Client, Graph, Meta, Storage) Source: https://github.com/vesoft-inc/nebula-operator/blob/master/doc/user/ssl_guide.md This configuration enables SSL encryption for all data transmission paths: between clients and the Graph service, between Graph and Meta services, and between Meta and Storage services. It requires setting `enable_ssl = true` for all relevant components and providing necessary server, client, and CA certificates via Kubernetes secrets. ```yaml apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula namespace: default spec: sslCerts: serverSecret: "server-cert" clientSecret: "client-cert" caSecret: "ca-cert" graphd: config: enable_ssl: "true" metad: config: enable_ssl: "true" storaged: config: enable_ssl: "true" ```