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

intro&deploy-nebula-operator-en #757

Merged
merged 6 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
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 @@
# What is Nebula Operator

## Concept of Nebula Operator

Nebula Operator is a tool to automate the deployment, and operation and maintenance of [Nebula Graph](https://github.com/vesoft-inc/nebula) clusters on [Kubernetes](https://kubernetes.io). Building upon the excellent scalability mechanism of Kubernetes, Nebula Graph introduced its operation and maintenance knowledge into the Kubernetes system, which makes Nebula Graph a real [cloud-native graph database](https://www.nebula-cloud.io/).
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

## How it works

For resource types that do not exist within Kubernetes,you can register them by adding custom API objects. The common way is to use the [CustomResourceDefinition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions).

Nebula Operator abstracts the deployment management of Nebula Graph clusters as a CRD. By combining multiple built-in API objects including StatefulSet, Service, and ConfigMap, the routine management and maintenance of a Nebula Graph cluster are coded as a control loop in the Kubernetes system. When a CR instance is submitted, Nebula Operator drives database clusters to the final state according to the control process.
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

## Functionalities of Nebula Operator
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

The following features are already available in Nebula Operator:

- **Deploy and uninstall clusters**:Nebula Operator simplifies the process of deploying and uninstalling clusters for users. Nebula Operator allows you to quickly create, update, or delete a Nebula Graph cluster by simply providing the corresponding CR file. For more information, see [Deploy Nebula Graph Clusters with Kubectl](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md) or [Deploy Nebula Graph Clusters with Helm](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md).
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

- **Scale clusters**:Nebula Operator calls Nebula Graph's native scaling interfaces in a control loop to implement the scaling logic. You can simply perform scaling operations with YAML configurations and ensure the stability of data. For more information, see [Scale clusters with Kubectl](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md#_3) or [Scale clusters with Helm](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md#_2).
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

- **Self-Healing**:Nebula Operator calls the interface provided by Nebula Graph clusters to dynamically sense cluster service status. Once an exception is detected, Nebula Operator performs fault tolerance. For more information, see [Self-Healing](5.operator-failover.md).
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

- **Balance Scheduling**: Based on the scheduler extension interface, the scheduler provided by Nebula Operator evenly distributes Pods in a Nebula Graph cluster across all nodes.

## Limitations

### Version limitations

Nebula Operator does not support v1.x version of Nebula Graph. Nebula Operator version and the corresponding Nebula Graph version are as follows:
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

| Nebula Operator version | Nebula Graph version |
| ------------------- | ---------------- |
| {{operator.release}}| {{nebula.release}} |

### Functionality limitations
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

Nebula Operator currently only support manual scaling of Nebula Graph clusters, and does not support automatic scaling of Nebula Graph clusters.
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved
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 @@
# Deploy Nebula Operator

You can deploy Nebula Operator with [Helm](https://helm.sh/).

## Background

[Nebula Operator](1.introduction-to-nebula-operator.md) automates the management of Nebula Graph clusters, and eliminates the need for you to install, scale, upgrade and uninstall Nebula Graph clusters, which lightens the burden on managing different application versions.
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites

### Install software

Before installing Nebula Operator, you need to install the following software and ensure the correct version of the software:

| Software | Requirement |
| ------------------------------------------------------------ | --------- |
| [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 |

If using a role-based access control policy, you need to enable [RBAC](https://kubernetes.io/docs/admin/authorization/rbac) (optional).

### Description of software

!!! note

The following software used by Nebula Operator is from the third party. Nebula Operator is not responsible for any problems that may arise during the software installation.

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

CoreDNS is a flexible and scalable DNS server that is [installed](https://github.com/coredns/deployment/tree/master/kubernetes) for Pods in Nebula Graph clusters.

Components in a Nebula Graph cluster communicate with each other via DNS resolutions for domain names, like `x.default.svc.cluster.local`.

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

!!! note

If you have set the value of the Nebula Operator configuration item `admissionWebhook.create` to `false`, there is no need to install cert-manager. For details about Nebula Operator configuration items, see the **Customize Helm charts** section in **Install Nebula Operator** below.

cert-manager is a tool that automates the management of certificates. It leverages extensions of the Kubernetes API and uses the Webhook server to provide dynamic access control to cert-manager resources. For more information about installation, see [cert-manager installation documentation](https://cert-manager.io/docs/installation/kubernetes/).

cert-manager is used to validate the numeric value of replicas for each component in a Nebula Graph cluster. If you run it in a production environment and care about the high availability of Nebula Graph clusters, it is recommended to set the value of `admissionWebhook.create` to `true` before installing cert-manager.

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

OpenKruise is a full set of standard extensions for Kubernetes. It works well with original Kubernetes and provides more powerful and efficient features for managing Pods, sidecar containers, and even container images in clusters. OpenKruise is required to enable advanced features for StatefulSets when Nebula Operator starts. For information about installation, see [openkruise installation documentation](https://openkruise.io/en-us/docs/installation.html).

## Steps

### Install Nebula Operator

1. Add the Nebula Operator chart repository to Helm.

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

2. Update information of available charts locally from chart repositories.

```bash
helm repo update
```

For more information about `helm repo`, see [Helm Repo](https://helm.sh/docs/helm/helm_repo/).

3. Install Nebula Operator.

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

- `<nebula-operator-system>` is a user-created namespace name. If you have not created this namespace, run `kubectl create namespace nebula-operator-system` to create one. You can also use a different name.

- `${chart_version}` is the version of the Nebula Operator chart. It can be unspecified when there is only one chart version in the Nebula Operator chart repository. Run `helm search repo -l nebula-operator` to see chart versions.

You can customize the configuration items of the Nebula Operator chart before running the installation command. For more information, see **Customize Helm charts** below。
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

### Customize Helm charts

Run `helm show values [CHART] [flags]` to see configurable options.

For example:

```yaml
[k8s@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
```

The parameters in `values.yaml` are described as follows:

| Parameter | Default value | Description |
| :------------------------------------- | :------------------------------ | :----------------------------------------- |
| `image.nebulaOperator.image` | `vesoft/nebula-operator:v0.8.0` | The image of Nebula Operator, version of which is v0.8.0. |
| `image.nebulaOperator.imagePullPolicy` | `IfNotPresent` | The image pull policy in Kubernetes. |
| `imagePullSecrets` | - | The image pull secret in Kubernetes. |
| `kubernetesClusterDomain` | `cluster.local`。 | The cluster domain. |
| `controllerManager.create` | `true` | Whether to enable the controller-manager component. |
| `controllerManager.replicas` | `2` | The numeric value of controller-manager replicas. |
| `admissionWebhook.create` | `true` | Whether to enable Admission Webhook. |
| `shceduler.create` | `true` | Whether to enable Scheduler. |
| `shceduler.schedulerName` | `nebula-scheduler` | The Scheduler name. |
| `shceduler.replicas` | `2` | the numeric value of nebula-scheduler replicas. |
abby-cyber marked this conversation as resolved.
Show resolved Hide resolved

You can run `helm install [NAME] [CHART] [flags]` to specify chart configurations when installing a chart. For more information, see [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing).

The following example shows how to specify the Nebula Operator's AdmissionWebhook mechanism to be turned off when you install Nebula Operator (AdmissionWebhook is enabled by default):

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

For more information about `helm install`, see [Helm Install](https://helm.sh/docs/helm/helm_install/).

### Upgrade Nebula Operator

After installing Nebula Operator, you can update it by modifying the parameter values in the `${HOME}/nebula-operator/charts/nebula-operator/values.yaml` file.

1. Clone the Nebula Operator repository to your local server.

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

2. Modify the parameter values in `${HOME}/nebula-operator/charts/nebula-operator/values.yaml`.

3. Run the following command to update 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>` is a user-created namespace name. Pods related to the nebula-operator repository are in this namespace.

### Uninstall Nebula Operator

1. Uninstall the Nebula Operator chart.

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

2. Delete CRD.

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

## What to do next

Automate the deployment of Nebula Graph clusters with Nebula Operator. For more information, see [Deploy Nebula Graph Clusters with Kubectl](3.deploy-nebula-graph-cluster/3.1create-cluster-with-kubectl.md) or [Deploy Nebula Graph Clusters with Helm](3.deploy-nebula-graph-cluster/3.2create-cluster-with-helm.md).