Skip to content

Upgrade NebulaGraph clusters created with Nebula Operator

This topic introduces how to upgrade a NebulaGraph cluster created with Nebula Operator.

Legacy version compatibility

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

Limits

  • Only for NebulaGraph clusters that have been created with Nebula Operator.
  • Only support upgrading the NebulaGraph version from 3.0.0 to 3.1.x.

Upgrade a NebulaGraph cluster with Kubectl

Prerequisites

You have created a NebulaGraph cluster with Kubectl. For details, see Create a NebulaGraph cluster with Kubectl.

The version of the NebulaGraph cluster to be upgraded in this topic is 3.0.0, and its YAML file name is apps_v1alpha1_nebulacluster.yaml.

Steps

  1. Check the image version of the services in the cluster.

    kubectl get pods -l app.kubernetes.io/cluster=nebula  -o jsonpath="{.items[*].spec.containers[*].image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c
    

    Output:

          1 vesoft/nebula-graphd:3.0.0
          1 vesoft/nebula-metad:3.0.0
          3 vesoft/nebula-storaged:3.0.0  
    
  2. Edit the apps_v1alpha1_nebulacluster.yaml file by changing the values of all the version parameters from 3.0.0 to v3.1.0.

    The modified YAML file reads 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.0 //Change the value from 3.0.0 to v3.1.0.
        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.0 //Change the value from 3.0.0 to v3.1.0.
        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.0 //Change the value from 3.0.0 to v3.1.0.
        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
    
  3. Run the following command to apply the version update to the cluster CR.

    kubectl apply -f apps_v1alpha1_nebulacluster.yaml
    
  4. After waiting for about 2 minutes, run the following command to see if the image versions of the services in the cluster have been changed to v3.1.0.

    kubectl get pods -l app.kubernetes.io/cluster=nebula  -o jsonpath="{.items[*].spec.containers[*].image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c
    

    Output:

          1 vesoft/nebula-graphd:v3.1.0
          1 vesoft/nebula-metad:v3.1.0
          3 vesoft/nebula-storaged:v3.1.0 
    

Upgrade a NebulaGraph cluster with Helm

Prerequisites

You have created a NebulaGraph cluster with Helm. For details, see Create a NebulaGraph cluster with Helm.

Steps

  1. Update the information of available charts locally from chart repositories.

    helm repo update
    
  2. Set environment variables to your desired values.

    export NEBULA_CLUSTER_NAME=nebula         # The desired NebulaGraph cluster name.
    export NEBULA_CLUSTER_NAMESPACE=nebula    # The desired namespace where your NebulaGraph cluster locates.
    
  3. Upgrade a NebulaGraph cluster.

    For example, upgrade a cluster to v3.1.0.

    helm upgrade "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \
        --namespace="${NEBULA_CLUSTER_NAMESPACE}" \
        --set nameOverride=${NEBULA_CLUSTER_NAME} \
        --set nebula.version=v3.1.0
    

    The value of --set nebula.version specifies the version of the cluster you want to upgrade to.

  4. Run the following command to check the status and version of the upgraded cluster.

    Check cluster status:

    $ kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" get pod -l "app.kubernetes.io/cluster=${NEBULA_CLUSTER_NAME}"
    NAME                READY   STATUS    RESTARTS   AGE
    nebula-graphd-0     1/1     Running   0          2m
    nebula-graphd-1     1/1     Running   0          2m
    nebula-metad-0      1/1     Running   0          2m
    nebula-metad-1      1/1     Running   0          2m
    nebula-metad-2      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
    

    Check cluster version:

    $ kubectl get pods -l app.kubernetes.io/cluster=nebula  -o jsonpath="{.items[*].spec.containers[*].image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c
          1 vesoft/nebula-graphd:v3.1.0
          1 vesoft/nebula-metad:v3.1.0
          3 vesoft/nebula-storaged:v3.1.0
    

Last update: March 13, 2023