Skip to content

Commit

Permalink
Helm Updates for 090 (#1214)
Browse files Browse the repository at this point in the history
* upgrade Helm

* Update 3.2create-cluster-with-helm.md

* describe optimization

* Update 9.upgrade-nebula-cluster.md

* Update 9.upgrade-nebula-cluster.md

* Update 2.deploy-nebula-operator.md
  • Loading branch information
abby-cyber committed Nov 16, 2021
1 parent bac6660 commit b80e8b6
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 55 deletions.
54 changes: 39 additions & 15 deletions docs-2.0/nebula-operator/2.deploy-nebula-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,20 @@
3. 安装Nebula Operator。

```bash
helm install nebula-operator nebula-operator/nebula-operator --namespace=<nebula-operator-system> --version=${chart_version}
helm install nebula-operator nebula-operator/nebula-operator --namespace=<namespace_name> --version=${chart_version}
```

- 上述命令中的`<nebula-operator-system>`为用户创建的命名空间。如果用户未创建该命名空间,可以执行`kubectl create namespace nebula-operator-system`进行创建。用户也可创建其他命名空间。
例如,安装{{operator.release}}版的Operator命令如下。

```bash
helm install nebula-operator nebula-operator/nebula-operator --namespace=nebula-operator-system --version={{operator.release}}
```

- 上述命令中的`nebula-operator-system`为用户创建的命名空间。如果用户未创建该命名空间,可以执行`kubectl create namespace nebula-operator-system`进行创建。用户也可创建其他命名空间。

- `${chart_version}`为Nebula Operator chart的版本。当Chart中只有一个默认版本时,可不指定。执行`helm search repo -l nebula-operator`查看Chart版本。
- `{{operator.release}}`为Nebula Operator chart的版本。当Chart中只有一个默认版本时,可不指定。执行`helm search repo -l nebula-operator`查看Chart版本。



用户可在执行安装Nebula Operator chart命令时自定义其配置。更多信息,查看下文**自定义配置Chart**

Expand Down Expand Up @@ -106,11 +114,11 @@ controllerManager:
env: []
resources:
limits:
cpu: 100m
memory: 30Mi
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 20Mi
memory: 100Mi

admissionWebhook:
create: true
Expand All @@ -122,18 +130,19 @@ scheduler:
env: []
resources:
limits:
cpu: 100m
memory: 30Mi
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 20Mi
memory: 100Mi
...
```

部分参数描述如下:

| 参数 | 默认值 | 描述 |
| :------------------------------------- | :------------------------------ | :----------------------------------------- |
| `image.nebulaOperator.image` | `vesoft/nebula-operator:latest` | Nebula Operator的镜像,版本为{{operator.branch}}。 |
| `image.nebulaOperator.image` | `vesoft/nebula-operator:latest` | Nebula Operator的镜像,版本为{{operator.release}}。 |
| `image.nebulaOperator.imagePullPolicy` | `IfNotPresent` | 镜像拉取策略。 |
| `imagePullSecrets` | - | 镜像拉取密钥。 |
| `kubernetesClusterDomain` | `cluster.local`| 集群域名。 |
Expand Down Expand Up @@ -169,16 +178,31 @@ helm install nebula-operator nebula-operator/nebula-operator --namespace=<nebula
3. 更新Nebula Operator。

```bash
helm upgrade nebula-operator nebula-operator/nebula-operator --namespace=<nebula-operator-system> -f ${HOME}/nebula-operator/charts/nebula-operator/values.yaml
helm upgrade nebula-operator nebula-operator/nebula-operator --namespace=<namespace_name> -f ${HOME}/nebula-operator/charts/nebula-operator/values.yaml
```

`<nebula-operator-system>`为用户创建的命名空间,nebula-operator相关Pods在此命名空间下。
`<namespace_name>`为用户创建的命名空间,nebula-operator相关Pods在此命名空间下。


### 升级Nebula Operator

<!--代码freeze 后需要补充
## 升级Nebula Operator
!!! Compatibility "历史版本兼容性"

-->
由于0.9.0版本的Nebula Operator的日志盘和数据盘分开存储,因此用升级后的Operator管理2.5.x版本的Nebula Graph集群会导致兼容性问题。用户可以备份2.5.x版本的Nebula Graph集群,然后使用升级版本的Operator创建2.6.x版本集群。

1. 拉取最新的Helm仓库。

```bash
helm repo update
```

2. 升级Operator。

```bash
helm upgrade nebula-operator nebula-operator/nebula-operator --namespace=<namespace_name> --version={{operator.release}}
```


### 卸载Nebula Operator

1. 卸载Nebula Operator chart。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,50 @@ helm uninstall "${NEBULA_CLUSTER_NAME}" --namespace="${NEBULA_CLUSTER_NAMESPACE}
| 参数 | 默认值 | 描述 |
| :-------------------------- | :----------------------------------------------------------- | ------------------------------------------------------------ |
| `nameOverride` | `nil` | 覆盖集群Chart的名称。 |
| `nebula.version` | `{{nebula.branch}}` | Nebula Graph的版本。 |
| `nebula.version` | `{{nebula.branch}}` | Nebula Graph的版本。 |
| `nebula.imagePullPolicy` | `IfNotPresent` | Nebula Graph镜像的拉取策略。关于拉取策略详情,请参考[Image pull policy](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy)|
| `nebula.storageClassName` | `nil` | 持久存储卷的类型,默认使用StorageClass的名字。 |
| `nebula.schedulerName` | `default-scheduler` | Nebula Graph集群的调度器。 |
| `nebula.reference` | `{"name": "statefulsets.apps", "version": "v1"}` | 为Nebula Graph引用的工作负载。 |
| `nebula.podLabels` | `{}` | Nebula Graph服务Pod的标签。 |
| `nebula.podAnnotations` | `{}` | Nebula Graph服务的注解。 |
| `nebula.graphd.image` | `vesoft/nebula-graphd` | Graphd容器镜像名称。使用 `nebula.version`中的值作为版本。 |
| `nebula.graphd.replicas` | `2` | Graphd服务的副本数。 |
| `nebula.graphd.env` | `[]` | Graphd服务的环境变量。 |
| `nebula.graphd.resources` | `{"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}}` | Graphd资源配置。 |
| `nebula.graphd.storage` | `1Gi` | Graphd服务的存储大小值。 |
| `nebula.graphd.logStorage` | `500Mi` | Graphd服务的日志盘大小。 |
| `nebula.graphd.podLabels` | `{}` | Graphd服务Pod的标签。 |
| `nebula.graphd.podAnnotations` | `{}` | Graphd服务Pod的注解。 |
| `nebula.graphd.nodeSelector` | `{}` |为Graphd pod设置节点标签以分配至指定的节点中。 |
| `nebula.graphd.tolerations` | `{}` |为Graphd pod设置容忍度。 |
| `nebula.graphd.affinity` | `{}` |为Graphd pod设置亲和性。 |
| `nebula.graphd.readinessProbe` | `{}` |为Graphd pod设置就绪探针以检测容器的状态。 |
| `nebula.graphd.sidecarContainers` | `{}` |为Graphd pod设置Sidecar Containers。 |
| `nebula.graphd.sidecarVolumes` | `{}` |为Graphd pod设置Sidecar Volumes。 |
| `nebula.metad.image` | `vesoft/nebula-metad` | Metad容器镜像名称。使用 `nebula.version`中的值作为版本。 |
| `nebula.metad.replicas` | `3` | Metad服务的副本数。 |
| `nebula.metad.env` | `[]` | Metad服务的环境变量。 |
| `nebula.metad.resources` | `{"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}}` | Metad服务的资源配置。 |
| `nebula.metad.storage` | `1Gi` | Graphd服务的存储大小值。 |
| `nebula.metad.logStorage` | `500Mi` | Metad服务的日志盘大小。 |
| `nebula.metad.dataStorage` | `1Gi` | Metad服务的数据盘大小。 |
| `nebula.metad.podLabels` | `{}` | Metad服务Pod的标签。 |
| `nebula.metad.podAnnotations` | `{}` | Metad服务Pod的注解。 |
| `nebula.metad.nodeSelector` | `{}` | 为Metad pod设置节点标签以分配至指定的节点中。 |
| `nebula.metad.tolerations` | `{}` | 为Metad pod设置容忍度。 |
| `nebula.metad.affinity` | `{}` | 为Metad pod设置亲和性。 |
| `nebula.metad.readinessProbe` | `{}` | 为Metad pod设置就绪探针以检测容器的状态。 |
| `nebula.metad.sidecarContainers` | `{}` | 为Metad pod设置Sidecar Containers。 |
| `nebula.metad.sidecarVolumes` | `{}` | 为Metad pod设置Sidecar Volumes。 |
| `nebula.storaged.image` | `vesoft/nebula-storaged` | Storaged容器镜像名称。使用 `nebula.version`中的值作为版本。 |
| `nebula.storaged.replicas` | `3` | Storaged服务的副本数。 |
| `nebula.storaged.env` | `[]` | Storaged服务的环境变量。 |
| `nebula.storaged.resources` | `{"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}}` | Storaged服务的资源配置。 |
| `nebula.storaged.storage` | `1Gi` | Storaged服务的存储空间值。 |
| `nebula.storaged.logStorage` | `500Mi` | Storaged服务的日志盘大小。 |
| `nebula.storaged.dataStorage` | `1Gi` | Storaged服务的数据盘大小。 |
| `nebula.storaged.podLabels` | `{}` | Storaged服务Pod的标签。 |
| `nebula.storaged.podAnnotations` |`{}` | Storaged服务Pod的注解。 |
| `nebula.storaged.nodeSelector` | `{}` | 为Storaged pod设置节点标签以分配至指定的节点中。 |
| `nebula.storaged.tolerations` | `{}` | 为Storaged pod设置容忍度。 |
| `nebula.storaged.affinity` | `{}` | 为Storaged pod设置亲和性。 |
| `nebula.storaged.readinessProbe` | `{}` | 为Storaged pod设置就绪探针以检测容器的状态。 |
| `nebula.storaged.sidecarContainers` | `{}` | 为Storaged pod设置Sidecar Containers。 |
| `nebula.storaged.sidecarVolumes` | `{}` | 为Storaged Pod设置Sidecar Volumes。 |
| `imagePullSecrets` | `[]` | 拉取镜像的Secret。 |
26 changes: 0 additions & 26 deletions docs-2.0/nebula-operator/4.connect-to-nebula-graph-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,32 +169,6 @@ data:
9769: "default/nebula-graphd-svc:9669"
```

在配置了名为`tcp-services`的ConfigMap后,其配置中的端口需要在定义了Nginx Ingress的服务中公开。

```yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx-ingress
component: default-backend
name: nginx-ingress-proxy-tcp
namespace: nginx-ingress
spec:
ports:
- name: proxied-tcp
port: 9769
protocol: TCP
targetPort: 9669
selector:
app: nginx-ingress
component: default-backend
type: "ClusterIP"
```

- `port`的值`9769`指外部端口,用户可自行设置。
- `targetPort`的值`9669`指要连接的graphd服务的端口。

操作步骤如下:

1. 创建名为`nginx-ingress-daemonset-hostnetwork.yaml`的文件。
Expand Down
80 changes: 72 additions & 8 deletions docs-2.0/nebula-operator/9.upgrade-nebula-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

本文介绍如何升级通过Nebula Operator创建的Nebula Graph集群。

## 前提条件

已创建Nebula Graph集群。具体步骤,参见[使用Kubectl创建Nebula Graph集群](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md)

本文示例中待升级的Nebula Graph版本为2.5.1,其YAML文件名为`apps_v1alpha1_nebulacluster.yaml`

## 使用限制

- 只支持使用Nebula Operator创建的Nebula Graph集群。

- 只支持升级Nebula Graph 2.5.x至2.6.x版本。

- 不支持升级通过0.8.0版Operator创建的集群。

## 使用Kubectl升级Nebula Graph集群。

### 前提条件

已创建Nebula Graph集群。具体步骤,参见[使用Kubectl创建Nebula Graph集群](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md)

本文示例中待升级的Nebula Graph版本为2.5.1,其YAML文件名为`apps_v1alpha1_nebulacluster.yaml`

## 操作步骤
### 操作步骤

1. 查看集群中服务的镜像版本。

Expand Down Expand Up @@ -126,4 +130,64 @@
1 vesoft/nebula-graphd:{{nebula.branch}}
1 vesoft/nebula-metad:{{nebula.branch}}
3 vesoft/nebula-storaged:{{nebula.branch}}
```
```

## 使用Helm升级Nebula Graph集群

### 前提条件

已创建Nebula Graph集群。具体步骤,参见[使用Helm创建Nebula Graph集群](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md)

### 操作步骤

1. 更新Helm仓库,拉取最新的仓库资源。

```bash
helm repo update
```

2. 配置Helm的环境变量。

```bash
export NEBULA_CLUSTER_NAME=nebula # Nebula Graph集群的名字。
export NEBULA_CLUSTER_NAMESPACE=nebula # Nebula Graph集群所处的命名空间的名字。
```

3. 升级Nebula Graph集群。

例如升级至{{nebula.branch}}Nebula Graph集群的命令如下。

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

`--set nebula.version`的值指需要升级集群的目标版本号。

4. 等待一会后,执行以下命令查看集群状态及集群版本。

查看集群状态:

```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
```

查看集群版本:

```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}}
```

0 comments on commit b80e8b6

Please sign in to comment.