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: adjust upgrade docs #8583

Merged
merged 11 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/user_docs/installation/install-kubeblocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The quickest way to try out KubeBlocks is to create a new Kubernetes cluster and

KubeBlocks is Kubernetes-native, you can use Helm or kubectl with a YAML file to install it. You can also use kbcli, an intuitive CLI tool, to install KubeBlocks.

To try out KubeBlocks on your local host, you can use the [Playground](./../../try-out-on-playground/try-kubeblocks-on-your-laptop.md) or [create a local Kubernetes test cluster first](./../prepare-a-local-k8s-cluster/prepare-a-local-k8s-cluster.md) and then follow the steps in this tutorial to install KubeBlocks.
To try out KubeBlocks on your local host, you can use the [Playground](./../try-out-on-playground/try-kubeblocks-on-your-laptop.md) or [create a local Kubernetes test cluster first](./prepare-a-local-k8s-cluster/prepare-a-local-k8s-cluster.md) and then follow the steps in this tutorial to install KubeBlocks.

:::note

Expand Down
2 changes: 1 addition & 1 deletion docs/user_docs/observability/monitor-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you are using KubeBlocks Playground, these addons are enabled by default.

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

1. View all built-in Addons and make sure the monitoring Addons are enabled. If the monitoring Addons are not enabled, [enable these addons](./../installation/install-with-kbcli/install-addons.md) first.
1. View all built-in Addons and make sure the monitoring Addons are enabled. If the monitoring Addons are not enabled, [enable these addons](./../installation/install-addons.md) first.

```bash
# View all addons supported
Expand Down
2 changes: 1 addition & 1 deletion docs/user_docs/overview/supported-addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_label: Supported addons

KubeBlocks uses Addons to extend support for various database engines. And there are currently over 30 Addons available in the KubeBlocks repository, which can be further categorized as follows sections.

For installing and enabling Addons, refer to install Addons [by kbcli](./../installation/install-with-kbcli/install-addons.md) or [by Helm](./../installation/install-with-helm/install-addons.md).
For installing and enabling Addons, refer to [Addon installation tutorial](./../installation/install-addons.md).

## Relational Databases

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
position: 4
label: 升级
label: Upgrade KubeBlocks
collapsible: true
collapsed: true
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This guide addresses common questions and issues that may arise when upgrading K

## Manually mark Addons

In earlier versions, KubeBlocks pre-installed some Addons in the Helm chart, but some of these Addons have been removed in the new version. Consequently, if you upgrade ddirectly from an older version to the latest, Helm will remove the CRs of these removed Addons, affecting the clusters created by these Addons. To prevent this, it is recommended to add the `"helm.sh/resource-policy": "keep"` annotation for Addons to ensure they remain during upgraing.
In earlier versions, KubeBlocks pre-installed some Addons in the Helm chart, but some of these Addons have been removed in the new version. Consequently, if you upgrade directly from an older version to the latest, Helm will remove the CRs of these removed Addons, affecting the clusters created by these Addons. To prevent this, it is recommended to add the `"helm.sh/resource-policy": "keep"` annotation for Addons to ensure they remain during upgrading.

### View the Addon annotation

Expand Down Expand Up @@ -47,15 +47,15 @@ kubectl get addon {addonName} -o json | jq '{name: .metadata.name, resource_poli

## Fix "cannot patch 'kubeblocks-dataprotection' with kind Deployment" error

When upgrading KubeBlocks to v0.8.x/v0.9.0, you might encounter the following error:
When upgrading KubeBlocks to v0.8.x/v0.9.x, you might encounter the following error:

```bash
Error: UPGRADE FAILED: cannot patch "kubeblocks-dataprotection" with kind Deployment: Deployment.apps "kubeblocks-dataprotection" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"dataprotection", "app.kubernetes.io/instance":"kubeblocks", "app.kubernetes.io/name":"kubeblocks"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable && cannot patch "kubeblocks" with kind Deployment: Deployment.apps "kubeblocks" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/component":"apps", "app.kubernetes.io/instance":"kubeblocks", "app.kubernetes.io/name":"kubeblocks"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
```

This is due to label modifications of KubeBlocks and KubeBlocks-Dataprotection in KubeBlocks v0.9.1.
This error occurs due to label modifications introduced for KubeBlocks and KubeBlocks-Dataprotection in KubeBlocks v0.9.x.

To resolve the issue, manually delete the `kubeblocks` and `kubeblocks-dataprotection` deployments, then run helm upgrade to complete the upgrade to v0.9.1.
To resolve the issue, manually delete the `kubeblocks` and `kubeblocks-dataprotection` deployments, then run helm upgrade to complete the upgrade to v0.9.x.

```bash
# Scale to 0 replica
Expand All @@ -66,44 +66,62 @@ kubectl -n kb-system scale deployment kubeblocks-dataprotection --replicas 0
kubectl delete -n kb-system deployments.apps kubeblocks kubeblocks-dataprotection
```

## Specify an image registry during KubeBlocks upgrade
## Specify an image registry during upgrading KubeBlocks

KubeBlocks v0.8.x uses `infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com` and `docker.io` as image registries and KubeBlocks v0.9.x uses `apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com` and `docker.io`.
Starting from v0.9.0, one of KubeBlocks' image registries has changed. Specifically, the registry prefix for one of the repositories has been updated from `infracreate-registry` to `apecloud-registry`. Other image registries remain unaffected. If you installed KubeBlocks before v0.9.0, check and update your image registry configuration during the upgrade.

When upgrading KubeBlocks, you can override the default image registry by specifying the following parameters.
1. Check the image registry of KubeBlocks.

<Tabs>
```bash
helm -n kb-system get values kubeblocks -a | yq .image.registry
```

<TabItem value="kbcli" label="kbcli" default>
If the image registry starts with `infracreate-registry` as shown below, you must specify the new image registry during the upgrade by changing the image registry prefix to `apecloud-registry`.

```bash
kbcli kb upgrade --version 0.9.1 \
--set admissionWebhooks.enabled=true \
--set admissionWebhooks.ignoreReplicasCheck=true \
--set image.registry=docker.io \
--set dataProtection.image.registry=docker.io \
--set addonChartsImage.registry=docker.io
```
<details>

</TabItem>
<summary>Output</summary>

<TabItem value="Helm" label="Helm">
```text
infracreate-registry.cn-xxx.xxx.com
```

```bash
helm -n kb-system upgrade kubeblocks kubeblocks/kubeblocks --version 0.9.1 \
--set admissionWebhooks.enabled=true \
--set admissionWebhooks.ignoreReplicasCheck=true \
--set image.registry=docker.io \
--set dataProtection.image.registry=docker.io \
--set addonChartsImage.registry=docker.io
```
</details>

2. Override the default image registry by specifying the following parameters.

<Tabs>

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

```bash
helm -n kb-system upgrade kubeblocks kubeblocks/kubeblocks --version 0.9.2 \
--set admissionWebhooks.enabled=true \
--set admissionWebhooks.ignoreReplicasCheck=true \
--set image.registry=apecloud-registry.cn-xxx.xxx.com \
--set dataProtection.image.registry=apecloud-registry.cn-xxx.xxx.com \
--set addonChartsImage.registry=apecloud-registry.cn-xxx.xxx.com
```

</TabItem>

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

```bash
kbcli kb upgrade --version 0.9.2 \
--set admissionWebhooks.enabled=true \
--set admissionWebhooks.ignoreReplicasCheck=true \
--set image.registry=apecloud-registry.cn-xxx.xxx.com \
--set dataProtection.image.registry=apecloud-registry.cn-xxx.xxx.com \
--set addonChartsImage.registry=apecloud-registry.cn-xxx.xxx.com
```

</TabItem>
</TabItem>

</Tabs>
</Tabs>

Here is an introdution to the flags in the above command.
Here is an introduction to the flags in the above command.

- `--set image.registry=docker.io` specifies the KubeBlocks image registry.
- `--set dataProtection.image.registry=docker.io` specifies the KubeBlocks-Dataprotection image registry.
- `--set addonChartsImage.registry=docker.io` specifies Addon Charts image registry.
- `--set image.registry=apecloud-registry.cn-xxx.xxx.com` specifies the KubeBlocks image registry.
- `--set dataProtection.image.registry=apecloud-registry.cn-xxx.xxx.com` specifies the KubeBlocks-Dataprotection image registry.
- `--set addonChartsImage.registry=apecloud-registry.cn-xxx.xxx.com` specifies Addon Charts image registry.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
title: Upgrade to KubeBlocks v0.8
title: Upgrade to v0.8
description: Upgrade to KubeBlocks v0.8, operation, tips and notes
keywords: [upgrade, 0.8]
sidebar_position: 3
sidebar_label: Upgrade to KubeBlocks v0.8
draft: true
---

import Tabs from '@theme/Tabs';
Expand All @@ -15,12 +14,16 @@ In this tutorial, you will learn how to upgrade to KubeBlocks v0.8.

:::note

Execute `helm -n kb-system list | grep kubeblocks` to check the current KubeBlocks version you are running, and then upgrade it.
Execute `helm -n kb-system list | grep kubeblocks` or `kbcli version` to check the current KubeBlocks version you are running, and then upgrade it.

:::

## Upgrade from KubeBlocks v0.7

<Tabs>

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

1. Set keepAddons.

KubeBlocks v0.8 streamlines the default installed engines and separates the addons from KubeBlocks operators to KubeBlocks-Addons repo, such as greptime, influxdb, neon, oracle-mysql, orioledb, tdengine, mariadb, nebula, risingwave, starrocks, tidb, and zookeeper. To avoid deleting addon resources that are already in use during the upgrade, execute the following commands:
Expand Down Expand Up @@ -73,6 +76,44 @@ helm -n kb-system upgrade kubeblocks kubeblocks/kubeblocks --version 0.8.1 --set

:::

</TabItem>

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

1. Download kbcli v0.8.

```bash
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s 0.8.1
```

2. Upgrade KubeBlocks.

```bash
kbcli kb upgrade --version 0.8.1 --set dataProtection.image.datasafed.tag=0.1.0
```

kbcli will automatically add the annotation `"helm.sh/resource-policy": "keep"` to ensure that existing addons are not deleted during the upgrade.

</TabItem>

</Tabs>

## Upgrade from KubeBlocks v0.6

If you are currently running KubeBlocks v0.6, please upgrade to v0.7.2 first.

1. Download kbcli v0.7.2.

```shell
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s 0.7.2
```

2. Upgrade to KubeBlocks v0.7.2.

```shell
kbcli kb upgrade --version 0.7.2
```

## FAQ

Refer to the [FAQ](./../faq.md) to address common questions and issues that may arise when upgrading KubeBlocks. If your question isn't covered, you can [submit an issue](https://github.com/apecloud/kubeblocks/issues/new/choose) or [start a discussion](https://github.com/apecloud/kubeblocks/discussions) on upgrading in GitHub.
Refer to the [FAQ](./faq.md) to address common questions and issues that may arise when upgrading KubeBlocks. If your question isn't covered, you can [submit an issue](https://github.com/apecloud/kubeblocks/issues/new/choose) or [start a discussion](https://github.com/apecloud/kubeblocks/discussions) on upgrading on GitHub.
Loading
Loading