diff --git a/docs/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md b/docs/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md index 4e6cca93d..b79b1882c 100644 --- a/docs/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md +++ b/docs/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md @@ -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 diff --git a/docs/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md b/docs/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md deleted file mode 100644 index 3c0956972..000000000 --- a/docs/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md +++ /dev/null @@ -1,38 +0,0 @@ -# GreptimeDB Operator - -## Install GreptimeDB Operator - -By utilizing the [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/), -[GreptimeDB Operator](https://github.com/GreptimeTeam/greptimedb-operator) can effectively manage GreptimeDB clusters on [Kubernetes](https://kubernetes.io/). -This operator abstracts the model of maintaining a highly available GreptimeDB cluster. - -You can use Helm to install GreptimeDB Operator. - -```shell -helm upgrade \ - --install greptimedb-operator greptime/greptimedb-operator \ - --create-namespace \ - -n greptimedb-admin -``` - -## Install and upgrade CRDs - -Helm cannot upgrade custom resource definitions in the `/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations). - -We support installing and upgrading CRDs automatically using the chart. You can disable this behavior by using `--set crds.install=false` when installing the chart: - -```shell -helm upgrade \ - --install greptimedb-operator greptime/greptimedb-operator \ - --create-namespace \ - -n greptimedb-admin \ - --set crds.install=false -``` - -When you uninstall the GreptimeDB Operator, it will not delete the CRDs by default. - - - -## Next steps - -- [Deploy GreptimeDB Cluster](deploy-greptimedb-cluster.md): This section provides instructions on how to deploy etcd cluster and GreptimeDB cluster on Kubernetes. diff --git a/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md b/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md new file mode 100644 index 000000000..e64add62d --- /dev/null +++ b/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md @@ -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 +``` \ No newline at end of file diff --git a/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md b/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md new file mode 100644 index 000000000..667aee67d --- /dev/null +++ b/docs/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md @@ -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 `. + +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" +``` \ No newline at end of file diff --git a/docs/user-guide/operations/deploy-on-kubernetes/overview.md b/docs/user-guide/operations/deploy-on-kubernetes/overview.md index 50b2437eb..e507b8d73 100644 --- a/docs/user-guide/operations/deploy-on-kubernetes/overview.md +++ b/docs/user-guide/operations/deploy-on-kubernetes/overview.md @@ -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. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current.json b/i18n/zh/docusaurus-plugin-content-docs/current.json index 931a993d7..d6e779212 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current.json +++ b/i18n/zh/docusaurus-plugin-content-docs/current.json @@ -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" diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md index 40e3c4cf4..173fd6136 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster.md @@ -1,6 +1,6 @@ # 部署 GreptimeDB 集群 -在部署之前,请确保你已经在 Kubernetes 集群上安装了 [GreptimeDB Operator](greptimedb-operator.md)。 +在部署之前,请确保你已经在 Kubernetes 集群上安装了 [GreptimeDB Operator](./manage-greptimedb-operator/deploy-greptimedb-operator.md)。 ## 使用 Helm 进行部署 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md deleted file mode 100644 index 69955713b..000000000 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/greptimedb-operator.md +++ /dev/null @@ -1,39 +0,0 @@ -# GreptimeDB Operator - -## 安装 GreptimeDB Operator - -通过利用 [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/), -[GreptimeDB Operator](https://github.com/GreptimeTeam/greptimedb-operator) 可以有效管理 [Kubernetes](https://kubernetes.io/) 上的 GreptimeDB 集群。 -这个 operator 可以抽象出维护高可用 GreptimeDB 集群的模式。 - -你可以使用 Helm 来安装 GreptimeDB Operator。 - -```shell -helm upgrade \ - --install oci://greptime-registry.cn-hangzhou.cr.aliyuncs.com/charts/greptimedb-operator greptimedb-operator \ - --set image.registry=greptime-registry.cn-hangzhou.cr.aliyuncs.com \ - --create-namespace \ - -n greptimedb-admin -``` - -## CRD 的安装和升级 - -Helm 被[设计](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations)为无法自动更新 `/crds`,为了方便部署,GreptimeDB 支持使用 Chart 自动安装和升级 CRD。你可以在安装 Chart 时使用 `--set crds.install=false` 来禁用这个行为: - -```shell -helm upgrade \ - --install oci://greptime-registry.cn-hangzhou.cr.aliyuncs.com/charts/greptimedb-operator greptimedb-operator \ - --set image.registry=greptime-registry.cn-hangzhou.cr.aliyuncs.com \ - --set crds.install=false \ - --create-namespace \ - -n greptimedb-admin \ - --set crds.install=false -``` - -当你卸载 GreptimeDB Operator 时,默认不会删除 CRD。 - - - -## Next steps - -- [部署GreptimeDB集群](deploy-greptimedb-cluster.md):本节介绍了如何在 Kubernetes 上部署 etcd 集群和 GreptimeDB 集群。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md new file mode 100644 index 000000000..f8ce63f44 --- /dev/null +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator.md @@ -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 +``` \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md new file mode 100644 index 000000000..06a8d90ec --- /dev/null +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator.md @@ -0,0 +1,93 @@ +# 升级 GreptimeDB Operator +你可以随时升级 GreptimeDB Operator,而不会影响已管理的 GreptimeDB 实例。本指南详细介绍了如何使用 Helm 将现有的 GreptimeDB Operator 从版本 0.2.1 升级到最新版本。 + +### 验证现有的 Operator 安装 + +首先,使用以下命令验证所有 Operator Pod 的健康状态和状态: + +```bash +kubectl get pods -n greptimedb-admin +``` + +如果 Operator 安装在自定义命名空间中,请使用 `-n ` 将 `greptimedb-admin` 替换为你的特定命名空间。 + +接下来,查看命名空间中的已安装 Helm charts: + +```bash +helm list -n greptimedb-admin +``` + +你应该看到类似如下的输出: +``` +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 +``` + +Operator chart 版本为 `greptimedb-operator-0.2.1` 的,APP 版本为 `0.1.0-alpha.28`。 + +### 更新 Operator 仓库 + +更新 GreptimeDB Operator 的 Helm 仓库以获取最新的 charts: + +```bash +helm repo update greptimedb-operator +``` + +如果在添加仓库时使用了不同的别名,请将 `greptimedb-operator` 替换为相应的别名。你可以通过以下命令查看你的 Helm 仓库: + +```bash +helm repo list +``` + +检查最新的可用 chart 版本: + +```bash +helm search repo greptimedb-operator +``` + +你应该看到类似如下的输出: +```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. +``` + +### 升级 Operator 版本 + +使用 Helm 将 GreptimeDB Operator 升级到最新版本: +```bash +helm upgrade -n greptimedb-admin \ + operator greptime/greptimedb-operator +``` + +如果 Operator 安装在不同的命名空间中,请使用 `-n` 参数指定它。另外,如果使用了不同的安装名称,请在命令中将 `operator` 替换为实际的安装名称。 + +该命令应该会返回一个成功的升级结果,并显示递增的 REVISION 值。 + +### (可选)使用本地 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 upgrade greptimedb-operator greptimedb-operator \ + --set image.registry=greptime-registry.cn-hangzhou.cr.aliyuncs.com \ + --create-namespace \ + -n greptimedb-admin +``` + +### 验证 Operator 升级 + +要确认升级成功,运行以下命令: +```bash +kubectl get pod -l 'app.kubernetes.io/name=operator' -n greptimedb-admin -o json | jq '.items[0].spec.containers[0].image' +``` + +你应该看到如下输出,表明 Operator 已成功升级到最新版本: +```bash +"docker.io/greptime/greptimedb-operator:v0.1.0-alpha.29" +``` \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/overview.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/overview.md index f7a0b9c8d..9a6599b81 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/overview.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/operations/deploy-on-kubernetes/overview.md @@ -47,6 +47,6 @@ helm upgrade --install mycluster \ 请按照以下步骤继续操作: -- [GreptimeDB Operator](greptimedb-operator.md):本章节指导你安装 GreptimeDB Operator。 +- [GreptimeDB Operator](./manage-greptimedb-operator/deploy-greptimedb-operator.md):本章节指导你安装 GreptimeDB Operator。 - [部署GreptimeDB集群](deploy-greptimedb-cluster.md):本节介绍了如何在 Kubernetes 上部署 etcd 集群和 GreptimeDB 集群。 - [销毁集群](destroy-cluster.md):本节介绍如何卸载 GreptimeDB Operator 和 GreptimeDB 集群。 diff --git a/sidebars.ts b/sidebars.ts index 25f6b2bd6..ee78b5c5c 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -157,7 +157,14 @@ const sidebars: SidebarsConfig = { label: 'Deploy on Kubernetes', items: [ 'user-guide/operations/deploy-on-kubernetes/overview', - 'user-guide/operations/deploy-on-kubernetes/greptimedb-operator', + { + type: 'category', + label: 'Manage GreptimeDB Operator', + items: [ + 'user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/deploy-greptimedb-operator', + 'user-guide/operations/deploy-on-kubernetes/manage-greptimedb-operator/upgrade-greptimedb-operator', + ] + }, 'user-guide/operations/deploy-on-kubernetes/deploy-greptimedb-cluster', 'user-guide/operations/deploy-on-kubernetes/destroy-cluster', ],