Skip to content

Commit

Permalink
en, zh: update documentation about PodRestarter (#724)
Browse files Browse the repository at this point in the history
* Update documentation about PodRestarter

Signed-off-by: Lonng <[email protected]>

* address comment

Signed-off-by: Lonng <[email protected]>
  • Loading branch information
lonng authored Oct 19, 2020
1 parent b6f5c9b commit e988e30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 70 deletions.
39 changes: 3 additions & 36 deletions en/restart-a-tidb-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ If you find that the memory leak occurs in a Pod during use, you need to restart
storage: "1Gi"
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
tikv:
baseImage: pingcap/tikv
replicas: 3
requests:
storage: "1Gi"
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
tidb:
baseImage: pingcap/tidb
replicas: 2
service:
type: ClusterIP
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
```
2. Apply the update:
Expand All @@ -62,36 +62,3 @@ If you find that the memory leak occurs in a Pod during use, you need to restart
``` shell
kubectl apply -f ${cluster_name} -n ${namespace}
```

## Gracefully restart a single Pod of the TiDB component

This section describes how to gracefully restart a single Pod of the component in a TiDB cluster.

### Enable the configurations

To activate the graceful logoff feature, you need to enable some related configurations in TiDB Operator. These configurations are disabled by default. Take the following steps to manually turn them on.

1. Edit the `values.yaml` file.

Enable the `Operator Webhook` feature:

```yaml
admissionWebhook:
create: true
```

For more information about `Operator Webhook`, see [Enable Admission Controller in TiDB Operator](enable-admission-webhook.md).

2. Install or update TiDB Operator.

To install or update TiDB Operator, see [Deploy TiDB Operator in Kubernetes](deploy-tidb-operator.md).

### Use annotate to mark the target Pod

You can use `kubectl annotate` to mark the target Pod component of the TiDB cluster. After marking, the TiDB Operator automatically performs graceful logoff of the Pod and restarts the target Pod. To mark the target Pod, run the following command:

{{< copyable "shell-regular" >}}

```sh
kubectl annotate ${pod_name} -n ${namespace} tidb.pingcap.com/pod-defer-deleting=true
```
37 changes: 3 additions & 34 deletions zh/restart-a-tidb-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restart-a-tidb-cluster/']
storage: "1Gi"
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
tikv:
baseImage: pingcap/tikv
replicas: 3
requests:
storage: "1Gi"
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
tidb:
baseImage: pingcap/tidb
replicas: 2
service:
type: ClusterIP
config: {}
annotations:
tidb.pingcap.com/restartedAt: "202004201200"
tidb.pingcap.com/restartedAt: 2020-04-20T12:00
```
2. 应用更新
Expand All @@ -58,34 +58,3 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restart-a-tidb-cluster/']
``` shell
kubectl apply -f ${cluster_name} -n ${namespace}
```

## 优雅重启 TiDB 集群组件的单个 Pod

### 开启相关设置

开启优雅下线功能,需要打开 Webhook 相关设置。默认情况下 Webhook 相关配置是关闭的,你需要手动开启:

1. 修改 Operator 的 `values.yaml`

开启 Operator Webhook 特性:

```yaml
admissionWebhook:
create: true
```

关于 Operator Webhook 详情,请参考[开启 TiDB Operator 准入控制器](enable-admission-webhook.md)

2. 安装/更新 TiDB Operator

修改完 `values.yaml` 文件中的上述配置项以后,进行 TiDB Operator 部署或者更新。安装与更新 TiDB Operator 请参考[在 Kubernetes 上部署 TiDB Operator](deploy-tidb-operator.md)。

### 使用 annotate 标记目标 Pod 节点

我们通过 `kubectl annotate` 的方式来标记目标 TiDB 集群 Pod 节点组件,当 `annotate` 标记完成以后,TiDB Operator 会自动进行 Pod 节点的优雅下线并重启。你可以通过以下方式来进行标记:

{{< copyable "shell-regular" >}}

```sh
kubectl annotate ${pod_name} -n ${namespace} tidb.pingcap.com/pod-defer-deleting=true
```

0 comments on commit e988e30

Please sign in to comment.