Skip to content

Commit

Permalink
content for Operator (#981)
Browse files Browse the repository at this point in the history
* operator document

* new for clusters and nebula operator

added deploy nebula graph clusters by two ways
added how to deploy nebula operator

* connect to nebula graph cluster

connect to nebula graph cluster

* add_failover

* updated

add-get started with operator and add des for parameters

* optimization&test updates

* added faq

* updates

* updates

* updates

* Update docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md

reasonable, accepted。

Co-authored-by: randomJoe211 <69501902+randomJoe211@users.noreply.github.com>

* updates

* updates

Co-authored-by: randomJoe211 <69501902+randomJoe211@users.noreply.github.com>
  • Loading branch information
abby-cyber and randomJoe211 committed Sep 24, 2021
1 parent ce7ba47 commit a1c66ec
Show file tree
Hide file tree
Showing 10 changed files with 788 additions and 11 deletions.
10 changes: 9 additions & 1 deletion docs-2.0/20.appendix/6.eco-tool-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Nebula Dashboard(简称Dashboard)是一款用于监控Nebula Graph集群中

## Nebula Explorer

Nebula Explorer(简称 Explorer)是一款可以通过 Web 访问的图探索可视化工具,搭配 Nebula Graph 内核使用,用于与图数据进行可视化交互。即使没有图数据操作经验,用户也可以快速成为图专家。详情参见[什么是Nebula Explorer](../nebula-explorer/about-explorer/ex-ug-what-is-explorer.md)
Nebula Explorer(简称Explorer)是一款可以通过Web访问的图探索可视化工具,搭配Nebula Graph内核使用,用于与图数据进行可视化交互。即使没有图数据操作经验,用户也可以快速成为图专家。详情参见[什么是Nebula Explorer](../nebula-explorer/about-explorer/ex-ug-what-is-explorer.md)

|Nebula Graph版本|Explorer版本(commit id)|
|:---|:---|
Expand All @@ -62,6 +62,14 @@ Nebula Exchange(简称Exchange)是一款Apache Spark&trade;应用,用于
|:---|:---|
| {{ nebula.release }} | {{exchange.release}}(3c0f4c6) |

## Nebula Operator

Nebula Operator(简称Operator)是用于在Kubernetes系统上自动化部署和运维Nebula Graph集群的工具。依托于Kubernetes扩展机制,Nebula Graph将其运维领域的知识全面注入至Kubernetes系统中,让Nebula Graph成为真正的云原生图数据库。详情请参加[什么是Nebula Operator](nebula-operator/1.introduction-to-nebula-operator.md)

|Nebula Graph版本|Operator版本(commit id)|
|:---|:---|
| {{ nebula.release }} | {{operator.release}}(6d1104e) |

## Nebula Importer

Nebula Importer(简称Importer)是一款Nebula Graph的CSV文件导入工具。Importer可以读取本地的CSV文件,然后导入数据至Nebula Graph图数据库中。详情请参见[什么是Nebula Importer](../nebula-importer/use-importer.md)
Expand Down
37 changes: 37 additions & 0 deletions docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 什么是Nebula Operator

## 基本概念

Nebula Operator是用于在[Kubernetes](https://kubernetes.io)系统上自动化部署和运维[Nebula Graph](https://github.com/vesoft-inc/nebula)集群的工具。依托于Kubernetes扩展机制,Nebula Graph将其运维领域的知识全面注入至Kubernetes系统中,让Nebula Graph成为真正的[云原生图数据库](https://www.nebula-cloud.io/)

## 工作原理

对于Kubernetes系统内不存在的资源类型,用户可以通过添加自定义API对象的方式注册,常见的方法是使用[CustomResourceDefinition(CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)

Nebula Operator将Nebula Graph集群的部署管理抽象为CRD。通过结合多个内置的API对象,包括StatefulSet、Service和ConfigMap,Nebula Graph集群的日常管理和维护被编码为一个控制循环。在Kubernetes系统内,每一种内置资源对象,都运行着一个特定的控制循环,将它的实际状态通过事先规定好的编排动作,逐步调整为最终的期望状态。当一个CR实例被提交时,Nebula Operator会根据控制流程驱动数据库集群进入最终状态。

## 功能介绍

Nebula Operator已具备的功能如下:

- **集群创建和卸载**:Nebula Operator简化了用户部署和卸载集群的过程。用户只需提供对应的CR文件,Nebula Operator即可快速创建或者删除一个对应的Nebula Graph集群。更多信息参考[使用Kubectl部署Nebula Graph集群](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md)或者[使用Helm部署Nebula Graph集群](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md)

- **集群扩容和缩容**:通过在控制循环中调用Nebula Graph原生提供的扩缩容接口,Nebula Graph封装Nebula Operator实现了扩缩容的逻辑,用户可以通过YAML配置进行简单的扩缩容,且保证数据的稳定性。更多信息参考[使用Kubeclt扩缩容集群](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl/#_3)[使用Helm扩缩容集群](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm/#_2)

- **故障自愈**:Nebula Operator调用Nebula Graph集群提供的接口,动态地感知服务状态。一旦发现异常,Nebula Operator自动进行容错处理。更多信息参考[故障自愈](5.operator-failover.md)

- **均衡调度**: 基于调度器扩展接口,Nebula Operator提供的调度器可以将应用Pods均匀地分布在Nebula Graph集群中。

## 使用限制

### 版本限制

Nebula Operator不支持v1.x版本的Nebula Graph,其与Nebula Graph版本的对应关系如下:

| Nebula Operator版本 | Nebula Graph版本 |
| ------------------- | ---------------- |
| {{operator.release}}| {{nebula.release}} |

### 功能限制

目前Nebula Operator只支持手动扩缩容Nebula Graph集群,不支持自动扩缩容Nebula Graph集群。
193 changes: 193 additions & 0 deletions docs-2.0/nebula-operator/2.deploy-nebula-operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# 部署Nebula Operator

用户可使用[Helm](https://helm.sh/)工具部署Nebula Operator。

## 背景信息

[Nebula Operator](1.introduction-to-nebula-operator.md)为用户管理Nebula Graph集群,使用户无需在生产环境中手动安装、扩展、升级和卸载Nebula Graph,减轻用户管理不同应用版本的负担。

## 前提条件

### 安装软件

安装Nebula Operator前,用户需要安装以下软件并确保安装版本的正确性:

| 软件 | 版本要求 |
| ------------------------------------------------------------ | --------- |
| [Kubernetes](https://kubernetes.io) | \>= 1.16 |
| [Helm](https://helm.sh) | \>= 3.2.0 |
| [CoreDNS](https://github.com/coredns/coredns) | \>= 1.6.0 |
| [CertManager](https://cert-manager.io) | \>= 1.2.0 |
| [OpenKruise](https://openkruise.io) | \>= 0.8.0 |

如果使用基于角色的访问控制的策略,用户需开启[RBAC](https://kubernetes.io/docs/admin/authorization/rbac)(可选)。

### 软件说明

!!! note

以下内容为Nebula Operator使用的第三方项目,Nebula Operator不负责处理安装这些软件过程中出现的问题.

- [CoreDNS](https://coredns.io/)

CoreDNS是一个灵活的、可扩展的DNS服务器,被[安装](https://github.com/coredns/deployment/tree/master/kubernetes)在集群内作为集群内Pods的DNS服务器。

Nebula Graph集群中的每个组件通过DNS解析类似`x.default.svc.cluster.local`这样的域名相互通信。

- [cert-manager](https://cert-manager.io/)

!!! note

如果用户已将Nebula Operator配置项`admissionWebhook.create`的值设为`false`,无需安装cert-manager。有关配置项的详情,请参考下文**安装Nebula Operator**中的**自定义配置Chart**部分。

cert-manager是一个自动化管理证书的工具,利用Kubernetes API扩展功能,使用Webhook服务器提供对cert-manager资源的动态准入控制。用户可参考[cert-manager installation documentation](https://cert-manager.io/docs/installation/kubernetes/)安装cert-manager。

cert-manager用于验证Nebula Graph的每个组件副本。如果用户在生产环境中运行它并关心Nebula Graph的高可用性,建议将`admissionWebhook.create`的值设为`true`,然后再安装cert-manager。

- [OpenKruise](https://openkruise.io/en-us/)

OpenKruise是Kubernetes的一整套标准扩展,能与原始的Kubernetes一起工作,为应用Pod、Sidecar容器,甚至是节点中的镜像的管理供更强大和高效的功能。Nebula Operator启动时需要用到OpenKruise开启针对StatefulSet的高级功能。用户可参考[openkruise installation documentation](https://openkruise.io/en-us/docs/installation.html)安装OpenKruise。

## 操作步骤

### 安装Nebula Operator

1. 添加Nebula Operator chart仓库至Helm。

```bash
helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
```

2. 拉取最新的Helm仓库。

```bash
helm repo update
```

参考[Helm仓库](https://helm.sh/docs/helm/helm_repo/)获取更多`helm repo`相关信息。

3. 安装Nebula Operator。

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

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

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

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

### 自定义配置Chart

执行`helm show values [CHART] [flags]`查看可配置的选项。

示例如下:

```yaml
[abby@master ~]$ helm show values nebula-operator/nebula-operator
image:
nebulaOperator:
image: vesoft/nebula-operator:v0.8.0
imagePullPolicy: IfNotPresent
kubeRBACProxy:
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
imagePullPolicy: IfNotPresent
kubeScheduler:
image: k8s.gcr.io/kube-scheduler:v1.18.8
imagePullPolicy: IfNotPresent
imagePullSecrets: []
kubernetesClusterDomain: ""
controllerManager:
create: true
replicas: 2
env: []
resources:
limits:
cpu: 100m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
admissionWebhook:
create: true
scheduler:
create: true
schedulerName: nebula-scheduler
replicas: 2
env: []
resources:
limits:
cpu: 100m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
```

`values.yaml`中参数描述如下:

| 参数 | 默认值 | 描述 |
| :------------------------------------- | :------------------------------ | :----------------------------------------- |
| `image.nebulaOperator.image` | `vesoft/nebula-operator:v0.8.0` | Nebula Operator的镜像,版本为v0.8.0。 |
| `image.nebulaOperator.imagePullPolicy` | `IfNotPresent` | 镜像拉取策略。 |
| `imagePullSecrets` | - | 镜像拉取密钥。 |
| `kubernetesClusterDomain` | `cluster.local`| 集群域名。 |
| `controllerManager.create` | `true` | 是否启用controller-manager。 |
| `controllerManager.replicas` | `2` | controller-manger副本数。 |
| `admissionWebhook.create` | `true` | 是否启用Admission Webhook。 |
| `shceduler.create` | `true` | 是否启用Scheduler。 |
| `shceduler.schedulerName` | `nebula-scheduler` | 调度器名称。 |
| `shceduler.replicas` | `2` | nebula-scheduler副本数。 |

执行`helm install [NAME] [CHART] [flags]`命令安装Chart时,可指定Chart配置。更多信息,参考[安装前自定义Chart](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing)。

以下示例为在安装Nebula Operator时,指定Nebula Operator的AdmissionWebhook机制为关闭状态(默认开启AdmissionWebhook):

```bash
helm install nebula-operator nebula-operator/nebula-operator --namespace=<nebula-operator-system> --set admissionWebhook.create=false
```

参考[Helm安装](https://helm.sh/docs/helm/helm_install/)获取更多`helm install`相关信息。

### 更新Nebula Operator

用户安装Nebula Operator后,可通过修改`${HOME}/nebula-operator/charts/nebula-operator/values.yaml`文件中参数的值来更新Nebula Operator。操作步骤如下:

1. 克隆Nebula Operator仓库至本机。

```bash
git clone https://github.com/vesoft-inc/nebula-operator.git
```

2. 修改`${HOME}/nebula-operator/charts/nebula-operator/values.yaml`文件中的参数值。

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

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

### 卸载Nebula Operator

1. 卸载Nebula Operator chart。

```bash
helm uninstall nebula-operator --namespace=<nebula-operator-system>
```

2. 删除CRD。

```bash
kubectl delete crd nebulaclusters.apps.nebula-graph.io
```

## 后续操作

使用Nebula Operator自动化部署Nebula Graph集群。更多信息,请参考[使用Kubectl部署Nebula Graph集群](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md)或者[使用Helm部署Nebula Graph集群](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md)。
Loading

0 comments on commit a1c66ec

Please sign in to comment.