Skip to content

Commit

Permalink
refactor: GreptimeDB Operator section (#1160)
Browse files Browse the repository at this point in the history
Co-authored-by: Yiran <cuiyiran3@gmail.com>
  • Loading branch information
WenyXu and nicecui committed Sep 10, 2024
1 parent caa25af commit 22030c5
Show file tree
Hide file tree
Showing 12 changed files with 333 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Deploy GreptimeDB Cluster

Before the deployment,
make sure you have already installed [GreptimeDB Operator](greptimedb-operator.md) on your Kubernetes cluster.
make sure you have already installed [GreptimeDB Operator](./manage-greptimedb-operator/deploy-greptimedb-operator.md) on your Kubernetes cluster.

## Using Helm for deployment

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Deploy GreptimeDB Operator

## Overview
The GreptimeDB Kubernetes Operator simplifies deploying GreptimeDB on both private and public cloud infrastructures. This guide walks you through installing the latest stable version of the GreptimeDB Operator on a Kubernetes cluster. The Operator leverages a [Custom Resource Definition (CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions) to represent GreptimeDB as a Kubernetes [object](https://kubernetes.io/docs/concepts/overview/working-with-objects/).


## Prerequisites
- [Helm](https://helm.sh/docs/intro/install/) (Use the Version appropriate for your Kubernetes API version)

## Install the GreptimeDB Operator using Helm Charts

GreptimeDB provides a [Helm-compatible repository](https://github.com/GreptimeTeam/helm-charts) for easy deployment. Follow these steps to install the Operator using Helm:

### Add the GreptimeDB Operator repository
First, add the GreptimeDB Operator Helm repository:
```bash
helm repo add greptime https://greptimeteam.github.io/helm-charts/
```

Validate the repository by searching for the Operator chart:
```bash
helm search repo greptimedb-operator
```

You should see output similar to this:
```
NAME CHART VERSION APP VERSION DESCRIPTION
greptime/greptimedb-operator 0.2.3 0.1.0-alpha.29 The greptimedb-operator Helm chart for Kubernetes.
```

### Install the Operator
To install the Operator, run the following `helm install` command. This command also creates a dedicated namespace `greptimedb-admin` for the installation. It's recommended to use a dedicated namespace for the Operator:
```bash
helm install \
operator greptime/greptimedb-operator \
--create-namespace \
-n greptimedb-admin
```

### Verify the CRD installation
Check the contents of the `greptimedb-admin` namespace to confirm that all Custom Resource Definitions (CRDs) have been installed correctly:

```bash
kubectl get crds -n greptimedb-admin
```

You should see output similar to this:
```bash
NAME CREATED AT
greptimedbclusters.greptime.io 2024-09-09T07:54:07Z
greptimedbstandalones.greptime.io 2024-09-09T07:54:07Z
```

### Verify the Operator installation
After installation, check the contents of the `greptimedb-admin` namespace to confirm that all pods are running correctly:
```bash
kubectl get pods -n greptimedb-admin
```

You should see output similar to this:
```bash
NAME READY STATUS RESTARTS AGE
operator-greptimedb-operator-7d58cb8f7c-jz46g 1/1 Running 0 26s
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Upgrade GreptimeDB Operator
You can upgrade the GreptimeDB Operator at any time without impacting your managed GreptimeDB instances. This guide details the steps to upgrade an existing GreptimeDB Operator installation using Helm, specifically from version 0.2.1 to the latest version.

### Verify the existing Operator installation.

First, verify the health and status of all Operator pods using:

```bash
kubectl get pods -n greptimedb-admin
```

If the Operator was installed in a custom namespace, replace `greptimedb-admin` with your specific namespace using `-n <NAMESPACE>`.

Next, view the installed Helm charts in the namespace:

```bash
helm list -n greptimedb-admin
```

You should see output similar to this:
```
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
operator greptimedb-admin 1 2024-08-30 08:04:53.388756424 +0000 UTC deployed greptimedb-operator-0.2.1 0.1.0-alpha.28
```

The Operator is currently installed with version `0.1.0-alpha.28` using the `greptimedb-operator-0.2.1` chart.

### Update the Operator repository

Update the GreptimeDB Operator Helm repository to fetch the latest charts:

```bash
helm repo update greptimedb-operator
```

If you used a different alias when adding the repository, replace `greptimedb-operator` with that alias. You can review your Helm repositories with:

```bash
helm repo list
```

Check the latest available chart version:

```bash
helm search repo greptimedb-operator
```

You should see output similar to this:
```bash
NAME CHART VERSION APP VERSION DESCRIPTION
greptime/greptimedb-operator 0.2.3 0.1.0-alpha.29 The greptimedb-operator Helm chart for Kubernetes.
```

### Upgrade the Operator version

Use Helm to upgrade the GreptimeDB Operator to the latest version:
```bash
helm upgrade -n greptimedb-admin \
operator greptime/greptimedb-operator
```

If the Operator is installed in a different namespace, specify it with the `-n` argument. Additionally, if you used a different installation name than operator, replace `operator` in the command.

The command should return a successful upgrade with an incremented `REVISION` value.

### Verify the Operator upgrade

To confirm the upgrade, run the following command:
```bash
kubectl get pod -l 'app.kubernetes.io/name=operator' -n greptimedb-admin -o json | jq '.items[0].spec.containers[0].image'
```

You should see the following output, indicating that the Operator has been successfully upgraded to the latest version:
```bash
"docker.io/greptime/greptimedb-operator:v0.1.0-alpha.29"
```
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ The deployment on Kubernetes involves the following components:

To deploy GreptimeDB on Kubernetes, follow these steps:

- [GreptimeDB Operator](greptimedb-operator.md): This section guides you on installing the GreptimeDB Operator.
- [GreptimeDB Operator](./manage-greptimedb-operator/deploy-greptimedb-operator.md): This section guides you on installing the GreptimeDB Operator.
- [Deploy GreptimeDB Cluster](deploy-greptimedb-cluster.md): This section provides instructions on how to deploy etcd cluster and GreptimeDB cluster on Kubernetes.
- [Destroy Cluster](destroy-cluster.md): This section describes how to uninstall the GreptimeDB Operator and the GreptimeDB cluster.
4 changes: 4 additions & 0 deletions i18n/zh/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"message": "部署到 Kubernetes",
"description": "The label for category Deploy on Kubernetes in sidebar docs"
},
"sidebar.docs.category.Manage GreptimeDB Operator": {
"message": "管理 GreptimeDB Operator",
"description": "The label for category Deploy on Kubernetes in sidebar docs"
},
"sidebar.docs.category.Disaster Recovery": {
"message": "灾难恢复",
"description": "The label for category Disaster Recovery in sidebar docs"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 部署 GreptimeDB 集群

在部署之前,请确保你已经在 Kubernetes 集群上安装了 [GreptimeDB Operator](greptimedb-operator.md)
在部署之前,请确保你已经在 Kubernetes 集群上安装了 [GreptimeDB Operator](./manage-greptimedb-operator/deploy-greptimedb-operator.md)

## 使用 Helm 进行部署

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 部署 GreptimeDB Operator

## 概述

GreptimeDB Kubernetes Operator 简化了在私有和公共云基础设施上部署 GreptimeDB 的过程。本指南将引导你在 Kubernetes 集群上安装最新的稳定版本的 GreptimeDB Operator。该 Operator 利用 [自定义资源定义 (CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions) 将 GreptimeDB 表示为 Kubernetes [对象](https://kubernetes.io/docs/concepts/overview/working-with-objects/)

## 先决条件
- [Helm](https://helm.sh/docs/intro/install/) (请使用与你的 Kubernetes API 版本相匹配的版本)

## 使用 Helm Charts 安装 GreptimeDB Operator

GreptimeDB 提供了一个 [兼容 Helm 的仓库](https://github.com/GreptimeTeam/helm-charts),便于部署。按照以下步骤使用 Helm 安装 Operator:

### 添加 GreptimeDB Operator 仓库
首先,添加 GreptimeDB Operator 的 Helm 仓库:
```bash
helm repo add greptime https://greptimeteam.github.io/helm-charts/
```

搜索 Operator chart 以验证仓库:
```bash
helm search repo greptimedb-operator
```

你应该看到类似如下的输出:
```
NAME CHART VERSION APP VERSION DESCRIPTION
greptime/greptimedb-operator 0.2.3 0.1.0-alpha.29 The greptimedb-operator Helm chart for Kubernetes.
```

### 安装 Operator

要安装 Operator,运行以下 `helm install` 命令。此命令还会为安装创建一个专用的命名空间 `greptimedb-admin`。推荐为 Operator 创建专用的命名空间:

```bash
helm install \
operator greptime/greptimedb-operator \
--create-namespace \
-n greptimedb-admin
```

### (可选)使用本地 Helm charts 进行安装

如您遇到网络问题,先拉取 chart 到本地:

```shell
wget https://downloads.greptime.cn/releases/charts/greptimedb-operator/latest/greptimedb-operator-latest.tgz
tar -zxvf greptimedb-operator-latest.tgz
```

然后安装 GreptimeDB Operator:

```shell
helm install greptimedb-operator greptimedb-operator \
--set image.registry=greptime-registry.cn-hangzhou.cr.aliyuncs.com \
--create-namespace \
-n greptimedb-admin
```

### 验证 CRD 安装
检查 `greptimedb-admin` 命名空间的内容,确认所有自定义资源定义 (CRD) 是否已正确安装:

```bash
kubectl get crds -n greptimedb-admin
```

你应该看到类似如下的输出:
```bash
NAME CREATED AT
greptimedbclusters.greptime.io 2024-09-09T07:54:07Z
greptimedbstandalones.greptime.io 2024-09-09T07:54:07Z
```

### 验证 Operator 安装
安装后,检查 `greptimedb-admin` 命名空间的内容,确认所有 Pod 是否正常运行:
```bash
kubectl get pods -n greptimedb-admin
```

你应该看到类似如下的输出:
```bash
NAME READY STATUS RESTARTS AGE
operator-greptimedb-operator-7d58cb8f7c-jz46g 1/1 Running 0 26s
```
Loading

0 comments on commit 22030c5

Please sign in to comment.