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

docs: merge cn api docs and update descriptions for termination policy #8414

Merged
merged 14 commits into from
Nov 11, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ KubeBlocks supports creating two types of ApeCloud MySQL clusters: Standalone an
|---------------------------------------|--------------------------------------|
| `spec.clusterDefinitionRef` | It specifies the name of the ClusterDefinition for creating a specific type of cluster. |
| `spec.clusterVersionRef` | It is the name of the cluster version CRD that defines the cluster version. |
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Halt`, `Delete`, `WipeOut`. <p> - `DoNotTerminate` blocks deletion operation. </p><p> - `Halt` deletes workload resources such as statefulset and deployment workloads but keep PVCs. </p><p> - `Delete` is based on Halt and deletes PVCs. </p><p> - `WipeOut` is based on Delete and wipe out all volume snapshots and snapshot data from a backup storage location. </p>|
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Delete`, `WipeOut`. For the detailed definition, you can refer to [Termination Policy](./delete-mysql-cluster.md#termination-policy). |
| `spec.affinity` | It defines a set of node affinity scheduling rules for the cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. |
| `spec.affinity.podAntiAffinity` | It specifies the anti-affinity level of Pods within a component. It determines how pods should spread across nodes to improve availability and performance. |
| `spec.affinity.topologyKeys` | It represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ The termination policy determines how a cluster is deleted.
| **terminationPolicy** | **Deleting Operation** |
|:----------------------|:-------------------------------------------------|
| `DoNotTerminate` | `DoNotTerminate` blocks delete operation. |
| `Halt` | `Halt` deletes workload resources such as statefulset, deployment workloads but keep PVCs. |
| `Delete` | `Delete` deletes workload resources and PVCs but keep backups. |
| `WipeOut` | `WipeOut` deletes workload resources, PVCs and all relevant resources included backups. |
| `Halt` | `Halt` deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. Halt policy is deprecated in v0.9.1 and will have same meaning as DoNotTerminate. |
| `Delete` | `Delete` extends the Halt policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. |
| `WipeOut` | `WipeOut` deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, especially in non-production environments, to avoid irreversible data loss. |

To check the termination policy, execute the following command.

Expand Down Expand Up @@ -63,7 +63,7 @@ Run the command below to delete a specified cluster.
<TabItem value="kbcli" label="kbcli" default>

```bash
kbcli cluster delete mycluster
kbcli cluster delete mycluster -n demo
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can restart all pods of the cluster. When an exception occurs in a database,
Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.

```bash
kbcli cluster restart <name> --components="mysql" --ttlSecondsAfterSucceed=30
kbcli cluster restart mycluster --components="mysql" --ttlSecondsAfterSucceed=30 -n demo
```

- `components` describes the component name that needs to be restarted.
Expand All @@ -33,7 +33,7 @@ You can restart all pods of the cluster. When an exception occurs in a database,
2. Check the cluster status to validate the restarting.

```bash
kbcli cluster list mycluster
kbcli cluster list mycluster -n demo
>
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
mycluster demo apecloud-mysql ac-mysql-8.0.30 Delete Running Sep 19,2024 16:01 UTC+0800
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The example below takes configuring `max_connections` and `innodb_buffer_pool_si
The whole searching process has a 30-second delay since it takes some time for kubelet to synchronize modifications to the volume of the pod.

```bash
kbcli cluster connect mycluster
kbcli cluster connect mycluster -n demo
```

```bash
Expand Down Expand Up @@ -219,7 +219,7 @@ The following steps take configuring MySQL Standalone as an example.

:::note

* Since ApeCloud MySQL currently supports multiple templates, it is required to use `--config-spec` to specify a configuration template. You can run `kbcli cluster describe-config mycluster` to view all template names.
* Since ApeCloud MySQL currently supports multiple templates, it is required to use `--config-spec` to specify a configuration template. You can run `kbcli cluster describe-config mycluster -n demo` to view all template names.
* If there are multiple components in a cluster, use `--components` to specify a component.

:::
Expand All @@ -233,7 +233,7 @@ The following steps take configuring MySQL Standalone as an example.
3. Connect to the database to verify whether the parameters are configured as expected.

```bash
kbcli cluster connect mycluster
kbcli cluster connect mycluster -n demo
```

:::note
Expand Down Expand Up @@ -344,6 +344,12 @@ KubeBlocks supports configuring cluster parameters by editing the configuration
1 row in set (0.00 sec)
```

:::note

Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.

:::

</TabItem>

<TabItem value="OpsRequest" label="OpsRequest">
Expand Down Expand Up @@ -426,63 +432,10 @@ KubeBlocks supports configuring cluster parameters with an OpsRequest.

:::note

Just in case you cannot find the configuration file of your cluster, you can use `kbcli` to view the current configuration file of a cluster.

```bash
kbcli cluster describe-config mycluster -n demo
```

From the meta information, the cluster `mycluster` has a configuration file named `my.cnf`.

You can also view the details of this configuration file and parameters.

* View the details of the current configuration file.

```bash
kbcli cluster describe-config mycluster --show-detail -n demo
```

* View the parameter description.

```bash
kbcli cluster explain-config mycluster -n demo | head -n 20
```

* View the user guide of a specified parameter.

```bash
kbcli cluster explain-config mycluster --param=innodb_buffer_pool_size --config-specs=mysql-consensusset-config -n demo
```

`--config-specs` is required to specify a configuration template since ApeCloud MySQL currently supports multiple templates. You can run `kbcli cluster describe-config mycluster` to view the all template names.

<details>

<summary>Output</summary>

```bash
template meta:
ConfigSpec: mysql-consensusset-config ComponentName: mysql ClusterName: mycluster

Configure Constraint:
Parameter Name: innodb_buffer_pool_size
Allowed Values: [5242880-18446744073709552000]
Scope: Global
Dynamic: false
Type: integer
Description: The size in bytes of the memory buffer innodb uses to cache data and indexes of its tables
```

</details>

* Allowed Values: It defines the valid value range of this parameter.
* Dynamic: The value of `Dynamic` in `Configure Constraint` defines how the parameter configuration takes effect. There are two different configuration strategies based on the effectiveness type of modified parameters, i.e. **dynamic** and **static**.
* When `Dynamic` is `true`, it means the effectiveness type of parameters is **dynamic** and can be configured online.
* When `Dynamic` is `false`, it means the effectiveness type of parameters is **static** and a pod restarting is required to make the configuration effective.
* Description: It describes the parameter definition.
Just in case you cannot find the configuration file of your cluster, you can switch to the `kbcli` tab and use relevant commands to view the current configuration file of a cluster.

:::

</TabItem>

</Tabs>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,7 @@ VTGate, VTConsensus, and VTTablet support parameter configuration. You can confi

</TabItem>

<TabItem value="kubectl" label="kubectl">

VTGate, VTConsensus, and VTTablet support parameter configuration. You can configure the proxy cluster by editing the configuration file or by performing an OpsRequest.

### Option 1. Edit the config file
<TabItem value="Edit Config File" label="Edit Config File">

1. Get the configuration file of this cluster.

Expand Down Expand Up @@ -478,7 +474,9 @@ VTGate, VTConsensus, and VTTablet support parameter configuration. You can confi
1 row in set (0.00 sec)
```

### Option 2. Apply an OpsRequest
</TabItem>

<TabItem value="OpsRequest" label="OpsRequest">

Apply an OpsRequest to the specified cluster. Configure the parameters according to your needs.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ EOF

| Field | Definition |
|---------------------------------------|--------------------------------------|
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Halt`, `Delete`, `WipeOut`. <p> - `DoNotTerminate` blocks deletion operation. </p><p> - `Halt` deletes workload resources such as statefulset and deployment workloads but keep PVCs. </p><p> - `Delete` is based on Halt and deletes PVCs. </p> - `WipeOut` is based on Delete and wipe out all volume snapshots and snapshot data from a backup storage location. |
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Delete`, `WipeOut`. For the detailed definition, you can refer to [Termination Policy](#termination-policy). |
| `spec.affinity` | It defines a set of node affinity scheduling rules for the cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. |
| `spec.affinity.podAntiAffinity` | It specifies the anti-affinity level of Pods within a component. It determines how pods should spread across nodes to improve availability and performance. |
| `spec.affinity.topologyKeys` | It represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. |
Expand Down Expand Up @@ -893,3 +893,76 @@ You can stop/start a cluster to save computing resources. When a cluster is stop
</TabItem>

</Tabs>

## Delete a cluster

### Termination policy

:::note

The termination policy determines how a cluster is deleted.

:::

| **terminationPolicy** | **Deleting Operation** |
|:----------------------|:-------------------------------------------------|
| `DoNotTerminate` | `DoNotTerminate` blocks delete operation. |
| `Halt` | `Halt` deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. Halt policy is deprecated in v0.9.1 and will have same meaning as DoNotTerminate. |
| `Delete` | `Delete` extends the Halt policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. |
| `WipeOut` | `WipeOut` deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, especially in non-production environments, to avoid irreversible data loss. |

To check the termination policy, execute the following command.

<Tabs>

<TabItem value="kbcli" label="kbcli" default>

```bash
kbcli cluster list mycluster -n demo
>
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
mycluster demo Delete Running Sep 27,2024 11:42 UTC+0800
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

```bash
kubectl get cluster mycluster -n demo
>
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
mydemo Delete Creating 27m
```

</TabItem>

</Tabs>

### Steps

Run the command below to delete a specified cluster.

<Tabs>

<TabItem value="kbcli" label="kbcli" default>

```bash
kbcli cluster delete mycluster -n demo
```

</TabItem>

<TabItem value="kubectl" label="kubectl">

If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster.

```bash
kubectl patch -n demo cluster mycluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"

kubectl delete -n demo cluster mycluster
```

</TabItem>

</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ This document shows how to create a Kafka cluster.
| `metadata.annotations.kubeblocks.io/enabled-pod-ordinal-svc` | It defines kafka cluster annotation keys for nodeport feature gate. You can also set`kubeblocks.io/enabled-node-port-svc: broker` and `kubeblocks.io/disabled-cluster-ip-svc: broker`. |
| `spec.clusterDefinitionRef` | It specifies the name of the ClusterDefinition for creating a specific type of cluster. |
| `spec.clusterVersionRef` | It is the name of the cluster version CRD that defines the cluster version. |
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Halt`, `Delete`, `WipeOut`. <p> - `DoNotTerminate` blocks deletion operation. </p><p> - `Halt` deletes workload resources such as statefulset and deployment workloads but keep PVCs. </p><p> - `Delete` is based on Halt and deletes PVCs. </p><p> - `WipeOut` is based on Delete and wipe out all volume snapshots and snapshot data from a backup storage location. </p> |
| `spec.terminationPolicy` | It is the policy of cluster termination. The default value is `Delete`. Valid values are `DoNotTerminate`, `Delete`, `WipeOut`. For the detailed definition, you can refer to [Termination Policy](./delete-kafka-cluster.md#termination-policy). |
| `spec.affinity` | It defines a set of node affinity scheduling rules for the cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. |
| `spec.affinity.podAntiAffinity` | It specifies the anti-affinity level of Pods within a component. It determines how pods should spread across nodes to improve availability and performance. |
| `spec.affinity.topologyKeys` | It represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ The termination policy determines how a cluster is deleted. Set the policy when

:::

| **terminationPolicy** | **Deleting Operation** |
|:-- | :-- |
| `DoNotTerminate` | `DoNotTerminate` blocks delete operation. |
| `Halt` | `Halt` deletes workload resources such as statefulset, deployment workloads but keep PVCs. |
| `Delete` | `Delete` deletes workload resources and PVCs but keep backups. |
| `WipeOut` | `WipeOut` deletes workload resources, PVCs and all relevant resources included backups. |
| **terminationPolicy** | **Deleting Operation** |
|:----------------------|:-------------------------------------------------|
| `DoNotTerminate` | `DoNotTerminate` blocks delete operation. |
| `Halt` | `Halt` deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. Halt policy is deprecated in v0.9.1 and will have same meaning as DoNotTerminate. |
| `Delete` | `Delete` extends the Halt policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. |
| `WipeOut` | `WipeOut` deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, especially in non-production environments, to avoid irreversible data loss. |

<Tabs>

Expand Down
Loading
Loading