> For the complete documentation index, see [llms.txt](https://docs.wproofreader.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wproofreader.com/v6.18.1/deployment/installation/kubernetes/upgrade-and-uninstall.md).

# Upgrade and uninstall

Upgrade the WProofreader stack on Kubernetes, or remove it.

Before you start, load the settings in your terminal:

```bash
cd ~/wproofreader-k8s
source wsc-stack.env
```

### Upgrade the stack

Upgrade WProofreader Server first. Its db-manager updates the `cloud_service` database before Admin-panel uses it.

{% hint style="info" %}
If you use the [wproofreader-gitops](https://github.com/WebSpellChecker/wproofreader-gitops) repository, update the chart revisions and values in Git. Do not run the Helm upgrade commands on this page. The GitOps controller can replace changes that you make directly in the cluster.
{% endhint %}

{% stepper %}
{% step %}

#### Back up the databases

Back up `admin_panel_db` and `cloud_service` with your MySQL backup procedure.

{% hint style="warning" %}
A Helm rollback does not undo database changes. Read the release notes before you upgrade. Make sure that you can restore the backup.
{% endhint %}
{% endstep %}

{% step %}

#### Get the new chart versions

```bash
git -C wproofreader-helm pull
git -C admin-panel-helm pull
```

Each command shows the changed files or `Already up to date.`
{% endstep %}

{% step %}

#### Select the WProofreader Server and db-manager images

If you use your own WProofreader Server image, build it for the new server version and push it to your registry with a new tag. See [Build using Dockerfile](/v6.18.1/deployment/installation/docker/build-using-dockerfile.md) or [Build using prebuilt configuration](/v6.18.1/deployment/installation/docker/build-using-prebuilt-configuration.md).

Edit the existing settings in `wproofreader-values.yaml`:

* Set `image.tag` to the new image tag. Update `image.repository` too if the image location changes.
* Set `databaseProvisioning.image.tag` to the WProofreader Server product version installed in that image. For example, a custom image tagged `6.18.1.0-company.2` that contains WProofreader Server `6.18.1.0` needs db-manager tag `6.18.1.0`.

Use a published db-manager image for that product version. If you mirror db-manager to your registry, copy the matching image there before you continue.

Keep the other values, including the MySQL administrator, Secret references, TLS, and storage settings. Pulling a newer chart does not change an explicitly configured `image.tag`.

For an evaluation using the default Docker Hub image, leave `image.tag` unset and remove any `databaseProvisioning.image.tag` override so both images use the new chart's `appVersion`.
{% endstep %}

{% step %}

#### Upgrade WProofreader Server

```bash
helm upgrade wproofreader-app ./wproofreader-helm/wproofreader \
  --namespace wsc \
  --values wproofreader-values.yaml \
  --timeout 15m
kubectl -n wsc rollout status deployment/wproofreader-app --timeout=15m
```

The rollout command shows `successfully rolled out`.

A new WProofreader Server version activates the license again. Repeat [Check the version and license](/v6.18.1/deployment/installation/kubernetes/install-wproofreader-server.md#check-the-version-and-license) after the upgrade and confirm that the server reports the version you selected. See [Upgrade application version](/v6.18.1/deployment/installation/upgrade-application-version.md).
{% endstep %}

{% step %}

#### Upgrade Admin-panel

If you did the steps in [Set up external access](/v6.18.1/deployment/installation/kubernetes/set-up-external-access.md), use both values files:

```bash
helm upgrade admin-panel ./admin-panel-helm/admin-panel \
  --namespace wsc \
  --values admin-panel-values.yaml \
  --values admin-panel-routing.yaml \
  --atomic \
  --timeout 10m
```

If you did not set up external access, remove the `--values admin-panel-routing.yaml` line.

The upgrade command shows `STATUS: deployed`.
{% endstep %}

{% step %}

#### Check the stack

```bash
kubectl -n wsc get pods
helm test admin-panel --namespace wsc
```

All Pods show `Running` or `Completed`. The test shows `Phase: Succeeded`.
{% endstep %}
{% endstepper %}

### Uninstall the stack

{% hint style="danger" %}
When you delete the `wsc` namespace, you delete MySQL and all its data if you installed MySQL with mysql-server-helm. Back up the databases first.
{% endhint %}

Remove the Helm releases:

```bash
helm uninstall admin-panel wproofreader-app --namespace wsc
```

If you installed MySQL with mysql-server-helm, remove it too:

```bash
helm uninstall mysql --namespace wsc
```

Delete the namespace. This deletes the Secrets, the completed Jobs, and the MySQL volume:

```bash
kubectl delete namespace wsc
```

If you use an existing MySQL server, the `admin_panel_db` and `cloud_service` databases stay on it. Delete them with your MySQL administration tools if you do not need them.
