Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 9.upgrade-nebula-cluster.md #913

Merged
merged 5 commits into from
Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions docs-2.0/nebula-operator/9.upgrade-nebula-cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Upgrade Nebula Graph clusters created with Nebula Operator

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


## Limits

- Only Nebula Graph clusters created with Nebula Operator are supported.

- Only upgrading Nebula Graph from 2.5.x to 2.6.x is supported.

- Upgrading clusters created via Nebula Operator of version 0.8.0 is not supported.


## Upgrade a Nebula Graph cluster with Kubectl

### Prerequisites

You have created a Nebula Graph cluster with Kubectl. For details, see [Create a Nebula Graph cluster with Kubectl](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md).

The version of the Nebula Graph cluster to be upgraded in this topic is `2.5.1`, and its YAML file name is `apps_v1alpha1_nebulacluster.yaml`.


### Steps

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

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

Output:

```bash
1 vesoft/nebula-graphd:v2.5.1
1 vesoft/nebula-metad:v2.5.1
3 vesoft/nebula-storaged:v2.5.1
```

2. Edit the `apps_v1alpha1_nebulacluster.yaml` file by changing the values of all the `version` parameters from v2.5.1 to {{nebula.branch}}.

The modified YAML file reads as follows:

```yaml
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: {{nebula.branch}} //Change the value from v2.5.1 to {{nebula.branch}}.
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: {{nebula.branch}} //Change the value from v2.5.1 to {{nebula.branch}}.
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: {{nebula.branch}} //Change the value from v2.5.1 to {{nebula.branch}}.
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.

```bash
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 {{nebula.branch}}.

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

Output:

```bash
1 vesoft/nebula-graphd:{{nebula.branch}}
1 vesoft/nebula-metad:{{nebula.branch}}
3 vesoft/nebula-storaged:{{nebula.branch}}
```

## Upgrade a Nebula Graph cluster with Helm

### Prerequisites

You have created a Nebula Graph cluster with Helm. For details, see [Create a Nebula Graph cluster with Helm](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md).

### Steps

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

```bash
helm repo update
```

2. Set environment variables to your desired values.

```bash
export NEBULA_CLUSTER_NAME=nebula # The desired Nebula Graph cluster name.
export NEBULA_CLUSTER_NAMESPACE=nebula # The desired namespace where your Nebula Graph cluster locates.
```

3. Upgrade a Nebula Graph cluster.

For example, upgrade a cluster to {{nebula.branch}}.

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

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:

```bash
$ 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:

```bash
$ 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:{{nebula.branch}}
1 vesoft/nebula-metad:{{nebula.branch}}
3 vesoft/nebula-storaged:{{nebula.branch}}
```