# Upgrade

Use this page to upgrade a Kubernetes (Helm) deployment.

{% hint style="warning" %}
Back up your PostgreSQL metadata databases before upgrading. See [Back up PostgreSQL](https://docs.syntho.ai/deploy-syntho/deploy-syntho-using-kubernetes/back-up-postgresql).
{% endhint %}

{% stepper %}
{% step %}
**Update values**

* **Syntho License key upgrade**
  * In `helm/ray/values.yaml`
    * <pre class="language-yaml"><code class="lang-yaml"><strong>SynthoLicense: &#x3C;new-license-key>
      </strong></code></pre>
  * In `helm/syntho-ui/values.yaml`
    * <pre class="language-yaml"><code class="lang-yaml"><strong>SynthoLicense: &#x3C;new-license-key>
      </strong></code></pre>
* **Application version upgrade**
  * `helm/ray/values.yaml`
    * ```yaml
      ray-cluster:
        image:
          tag: <new-version-number>
      ```
  * `helm/syntho-ui/values.yaml`
    * ```yaml
      frontend:
        image:
          tag: <new-version-number>
      backend:
        image:
          tag: <new-version-number>
      core:
        image:
          tag: <new-version-number>
      ```

{% endstep %}

{% step %}
**Rotate ImagePullSecret (if registry credentials changed)**

```bash
kubectl delete secret syntho-cr-secret -n syntho
kubectl create secret docker-registry syntho-cr-secret \
  --namespace syntho \
  --docker-server=<REGISTRY_HOST> \
  --docker-username=<USERNAME> \
  --docker-password=<PASSWORD>
```

{% endstep %}

{% step %}
**Apply the upgrade**

```bash
helm upgrade ray-cluster ./helm/ray/chart \
  --values helm/ray/values.yaml \
  --namespace syntho

helm upgrade syntho-ui ./helm/syntho-ui \
  --values helm/syntho-ui/values.yaml \
  --namespace syntho
```

{% endstep %}

{% step %}
**Verify**

```bash
kubectl get pods -n syntho
kubectl get events -n syntho --sort-by=.lastTimestamp | tail -n 30
```

If pods are restarting:

```bash
kubectl logs -n syntho <pod-name>
```

{% endstep %}
{% endstepper %}

<details>

<summary>Ray CRDs (only for some upgrades)</summary>

Some Ray/KubeRay upgrades require CRD changes.

If Helm reports CRD-related errors, upgrade the CRDs first (or reinstall Ray following the guidance from Syntho Support).

</details>
