---
title: "Upgrade and uninstall"
description: "Upgrade the control plane with one helm command, what happens to the store and to running endpoints, the way back, and a clean uninstall."
url: "https://opod.io/docs/control-plane-install/upgrade/"
markdown_url: "https://opod.io/docs/control-plane-install/upgrade.md"
section: "Install"
last_updated: "2026-11-01"
---

# Upgrade and uninstall

> Upgrade the control plane with one helm command, what happens to the store and to running endpoints, the way back, and a clean uninstall.

## In short

An upgrade is one `helm upgrade` with `--reset-then-reuse-values`. Endpoints keep serving and are not restarted: each keeps its pods until you roll it out. The new control plane applies any schema steps to its database on start. Take a backup first, because a schema step is the one thing a `helm rollback` cannot undo.

## When you need it

- A new chart version is out and you want its fixes.
- The doctor row `template-drift` is red after an upgrade, and you must decide when to roll each endpoint.
- An upgrade went wrong and you need the way back.
- You move from `0.2.1` (SQLite) to `0.3.0` (Postgres).
- You remove opod from a cluster.

## Do it

```bash
helm upgrade opodcp oci://ghcr.io/opod-io/charts/opodcp --version <X.Y.Z> -n opodcp --reset-then-reuse-values
```

Use `--reset-then-reuse-values`, never plain `--reuse-values`. Plain `--reuse-values` keeps only what the old install set and drops every default the new chart added.

The chart pins the control plane image by digest, so an upgrade never pulls a floating tag. Read the new version's notes first:

```bash
helm show readme oci://ghcr.io/opod-io/charts/opodcp --version <X.Y.Z>
helm show values oci://ghcr.io/opod-io/charts/opodcp --version <X.Y.Z>
```

### Order of operations

1. **Check and back up**

   `opodcp doctor` is green, or you understand each red row. Take a backup. It is **required** when the release notes name a schema step: it is the only way back to the previous release.

   ```bash
   kubectl -n opodcp port-forward svc/opodcp 8080:8080 &
   curl -s -H "Authorization: Bearer <admin token>" http://127.0.0.1:8080/api/v1/backup -o before-upgrade.jsonl
   ```

2. **Upgrade**

   Run the command above. One replica restarts; with several, they roll one at a time.

3. **Watch it come up**

   ```bash
   kubectl -n opodcp rollout status deploy/opodcp
   kubectl -n opodcp exec deploy/opodcp -- /opodcp doctor
   ```

   A store it refuses says why in the pod log and in setup mode.

4. **Roll endpoints when you choose**

   If the doctor row `template-drift` is red, roll out each endpoint it names (**Roll out plan…** on the endpoint page, or `opodcp endpoint rollout --wait NAME`). Until then each keeps its running pods.

## Check it worked

```bash
helm history opodcp -n opodcp --max 2
kubectl -n opodcp port-forward svc/opodcp 8080:8080 &
curl -s -H "Authorization: Bearer <admin token>" http://127.0.0.1:8080/api/v1/version | jq -r .version
kubectl -n opodcp exec deploy/opodcp -- /opodcp doctor | grep -E '^✘'
```

A good answer: the last `helm history` row is `deployed` with the new chart version, `/api/v1/version` prints the new version, and the only `✘` row, if any, is `template-drift`, which clears as you roll each endpoint. The console's **Settings** page shows the version, and **Activity** lists `endpoint.template-drift` for each endpoint still to roll.

## If it fails

| Symptom                                                                                                       | Cause                                               | Fix                                                                         |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------- |
| `Error: UPGRADE FAILED: … Job Failed`                                                                         | the pre-upgrade preflight found a fatal row         | `kubectl -n opodcp logs job/opodcp-preflight`; fix it and upgrade again     |
| `ports.usage is not a chart value any more`                                                                   | an upgrade from `0.2.1` with connector values       | follow [From 0.2.1 to 0.3.0](#from-021-to-030)                              |
| The pod logs `store schema N was written by a newer opodcp; this binary knows schema M` and serves setup mode | a rollback below a schema step                      | restore the backup taken before the upgrade ([The way back](#the-way-back)) |
| A new default is missing after the upgrade                                                                    | plain `--reuse-values`                              | upgrade again with `--reset-then-reuse-values`                              |
| `template-drift` stays red                                                                                    | an endpoint was not rolled                          | `opodcp endpoint rollout --wait NAME` for each endpoint it names            |
| `the server could not find the requested resource` on a ScaledObject                                          | `substrate.keda.enabled` was turned off and back on | see the KEDA warning under [Uninstall](#uninstall)                          |

## What happens to the store

The store carries a schema version. On boot the new binary:

1. **Applies the missing schema steps in order**, each in one transaction, under a Postgres advisory lock, so replicas that start together migrate once. Steps only add tables and columns.
2. **Refuses a store a newer release wrote.** The pod logs `store schema N was written by a newer opodcp; this binary knows schema M — upgrade the binary` and serves setup mode. Nothing is written.
3. **Refuses a store from before the schema baseline**, with the way across: back up with the release that wrote it, restore into an empty database.

The control plane takes no dump of its own before a step. Take the backup yourself.

**Usage rows survive.** A planned upgrade loses no GPU-seconds: on `SIGTERM` the control plane writes every open occupancy segment before it exits. A crash or an OOM kill loses at most the last 15 minutes per worker pod. Rows already in the store when retention first applies are kept until you opt in with `OPODCP_USAGE_TRIM_EXISTING`.

## What happens to endpoints

Endpoints keep serving through the whole upgrade, and none is restarted. Their plan, keys and policy are mounted files.

**A template change waits for a rollout.** Each endpoint's leader and workers are pinned to the images its last rollout chose, so an upgrade never re-pins them. When the new release renders a pod differently (a new variable, a probe, a mount, a resource request), the control plane holds the running template, keeps the replica count, and reports it: event `endpoint.template-drift` and doctor row `template-drift` name each endpoint. A verified rollout of that endpoint renders the new template and clears the row.

**Usage across the upgrade to 0.3.0.** That release renders two new variables into every leader (`OPOD_USAGE_OTLP_ENDPOINT` and `OPOD_USAGE_OTLP_HEADERS`), so each endpoint reports `template-drift` until you roll it. Until then the control plane keeps pulling its leader's usage stream. After a rollout to a leader from core v0.4.0 the leader pushes instead. During the rollout the control plane takes both: it pulls the old leader and receives the new one's push. `GET /api/v1/usage/streams` shows each endpoint's `mode`.

While a row is red:

- **Any plan edit renders the held templates too**, outside a verified rollout. The control plane says so with `endpoint.template-rolled`.
- **Autoscaling keeps working.** A worker grown meanwhile uses the new render, so the endpoint runs a mixed set until you roll it.
- The same row appears when a device plugin, node labels, fabric facts or a chart value change the render.

## The way back

- **No schema step ran:** `helm rollback opodcp <revision>`, or `helm upgrade` to the previous version. The store opens as it is.
- **A schema step ran:** the previous binary refuses the store. Restore the backup you took into an empty database with the previous binary:

```bash
kubectl -n opodcp scale deploy/opodcp --replicas=0
helm rollback opodcp <revision>
OPODCP_STATE_DSN=postgres://…/opodcp_restored opodcp restore before-upgrade.jsonl
# point the release at that database (ports.state.dsnSecret), then:
kubectl -n opodcp scale deploy/opodcp --replicas=1
```

Leaders serve throughout. Endpoints created between the upgrade and the rollback exist in the cluster but not in the restored store: the doctor row `endpoint-identity` names them as foreign objects, never adopted or deleted. Recreate them, or delete them by their `opod.io/endpoint-id` label.

## From `0.2.1` to `0.3.0`

`0.3.0` moves the store from SQLite to your Postgres and moves connector settings out of the chart.

1. **Note your connector values**

   ```bash
   helm get values opod -n opod
   ```

   Every `ports.<port>` value other than `ports.state` now fails the render. Note each one.

2. **Dump the SQLite store**

   ```bash
   kubectl -n opod exec deploy/opod-opodcp -- /opodcp backup -o - > dump.jsonl
   ```

3. **Upgrade against an empty Postgres**

   ```bash
   kubectl -n opod create secret generic opod-state --from-literal=dsn='postgres://…'
   helm upgrade opod oci://ghcr.io/opod-io/charts/opod --version 0.3.0 -n opod --reset-then-reuse-values \
     --set ports.state.dsnSecret.name=opod-state --set ports.usage=null --set ports.events=null   # one null per old port value
   kubectl -n opod scale deploy/opod-opodcp --replicas=0
   ```

4. **Restore, then start**

   With `OPODCP_STATE_DSN` pointing at the new database and the new binary. `--wipe` empties the tables the first start already seeded (the model catalog):

   ```bash
   opodcp restore --wipe dump.jsonl         # 0.3.6
   # the release after 0.3.6 asks first; in a script: opodcp restore --wipe --yes dump.jsonl
   kubectl -n opod scale deploy/opod-opodcp --replicas=1
   ```

5. **Save the connectors**

   Enter the values you noted on the **Connectors** page. Each save asks for one restart.

## From `0.3.0`

From `0.3.2` the chart, its release and its namespace are `opodcp`; `0.3.0` named all three `opod`. Helm cannot rename a release, so this one upgrade is an uninstall and an install against the **same database**. Your endpoints pause while the new control plane creates their objects again in the new namespace. That takes minutes and loses no state: the plans are in the database.

1. **Check and back up**

   ```bash
   kubectl -n opod exec deploy/opod-opodcp -- /opodcp doctor
   kubectl -n opod exec deploy/opod-opodcp -- /opodcp backup -o - > before-rename.jsonl
   ```

2. **Copy the two Secrets into the new namespace**

   The install key (without it the stored connector credentials stay sealed) and the database URL. Use your own DSN Secret's name in place of `opod-state`:

   ```bash
   kubectl create namespace opodcp
   kubectl -n opod get secret opod-opodcp-install-key -o jsonpath='{.data.keys}' | base64 -d > keys
   kubectl -n opodcp create secret generic opodcp-install-key --from-file=keys=keys && rm keys
   kubectl -n opod get secret opod-state -o jsonpath='{.data.dsn}' | base64 -d > dsn
   kubectl -n opodcp create secret generic opodcp-state --from-file=dsn=dsn && rm dsn
   ```

3. **Remove the old release**

   The endpoints' pods hold the GPUs the new release needs. The control plane created them, so helm alone leaves them running; deleting the namespace stops them.

   ```bash
   helm get values opod -n opod > values-0.3.0.yaml   # your other values, for the install below
   helm uninstall opod -n opod
   kubectl delete namespace opod
   ```

4. **Install the newest release**

   ```bash
   helm install opodcp oci://ghcr.io/opod-io/charts/opodcp --version 0.3.6 -n opodcp -f values-0.3.0.yaml \
     --set installKey.existingSecret=opodcp-install-key --set ports.state.dsnSecret.name=opodcp-state
   ```

5. **Check**

   Watch every endpoint reach **serving** in the console, then:

   ```bash
   kubectl -n opodcp exec deploy/opodcp -- /opodcp doctor
   ```

`values-0.3.0.yaml` may still name the old Secrets (`installKey.existingSecret`, `ports.state.dsnSecret.name`); the two `--set` flags come after it and win.

## Uninstall

```bash
helm uninstall opodcp -n opodcp
```

This deletes the control plane. It does not touch your database. It keeps the admin Secret and the install key Secret: keep the install key with your database backup if you may reinstall over the same database.

Objects the control plane created while it ran — endpoints' leaders and workers, the GPU telemetry DaemonSets, their Secrets and ConfigMaps — stay in the namespace. Delete the endpoints from the console or the API **before** you uninstall. Then `kubectl delete namespace opod` removes the rest.

> **KEDA**
>
> Turning `substrate.keda.enabled` off after it was on removes KEDA's CRDs and every ScaledObject with them, and Helm does not re-install CRDs on a later upgrade. Toggle it once, at install.

To remove the cluster itself on bare machines: `opodcp infra down -f machines.yaml`.
