> For the complete documentation index, see [llms.txt](https://docs.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.collibra.com/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted/roll-back-a-data-quality-observability-self-hosted-deployment-on-kubernetes.md).

# Roll back a Data Quality & Observability (self-hosted) deployment on Kubernetes

In a Kubernetes deployment, `dq-webapp` and `dq-agent` run as pods managed by Deployments or StatefulSets, and the Metastore is typically a managed PostgreSQL service or a PostgreSQL pod with a PersistentVolumeClaim. Use this procedure to restore the previous version after an unsuccessful upgrade.

{% hint style="info" %}
Before you start, confirm you completed the [Roll back Data Quality & Observability (self-hosted)](/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted.md#pre-upgrade-checklist) before upgrading.
{% endhint %}

## Prerequisites

* `kubectl` access to the cluster with permissions to manage Deployments and StatefulSets in the Collibra DQ namespace.
* The previous container image tags for `dq-webapp` and `dq-agent`.
* The Metastore snapshot from before the upgrade (required if schema migrations ran).

## Steps

{% stepper %}
{% step %}
Scale down the current deployments to stop all running pods.

```
kubectl scale deployment dq-webapp --replicas=0 -n <namespace>
kubectl scale deployment dq-agent  --replicas=0 -n <namespace>
```

Wait until all pods terminate.

```
kubectl get pods -n <namespace> -w
```

{% endstep %}

{% step %}
Restore the Metastore if schema migrations ran during the upgrade.

{% hint style="info" %}
Skip this step if the upgrade was a patch release with no schema migrations.
{% endhint %}

For a managed PostgreSQL service, restore from the snapshot you took before the upgrade. For a PostgreSQL pod with a PVC, use `pg_restore`:

```
kubectl exec -it <postgres-pod> -n <namespace> -- \
  pg_restore -U <METASTORE_USER> -d owldb /backup/owldb_backup_<timestamp>.dump
```

{% endstep %}

{% step %}
Update the container image tags in the Deployment manifests to the previous version.

```
kubectl set image deployment/dq-webapp \
  dq-webapp=<registry>/dq-webapp:<old-version> \
  -n <namespace>
 
kubectl set image deployment/dq-agent \
  dq-agent=<registry>/dq-agent:<old-version> \
  -n <namespace>
```

Alternatively, use `kubectl rollout undo` if the upgrade was the most recent deployment change and no configuration changes were made:

```
kubectl rollout undo deployment/dq-webapp -n <namespace>
kubectl rollout undo deployment/dq-agent  -n <namespace>
```

{% endstep %}

{% step %}
Scale the deployments back up.

```
kubectl scale deployment dq-webapp --replicas=<desired-count> -n <namespace>
kubectl scale deployment dq-agent  --replicas=<desired-count> -n <namespace>
```

{% endstep %}

{% step %}
Monitor the rollout and confirm pods reach `Running` status.

```
kubectl rollout status deployment/dq-webapp -n <namespace>
kubectl rollout status deployment/dq-agent  -n <namespace>
 
kubectl logs -f deployment/dq-webapp -n <namespace>
kubectl logs -f deployment/dq-agent  -n <namespace>
```

Confirm all items in the [Roll back a Data Quality & Observability (self-hosted) deployment on Kubernetes](#verification-checklist).
{% endstep %}
{% endstepper %}

## Rollback verification checklist

After the rollback, confirm the following before declaring success:

* `dq-webapp` pod is `Running` and the health endpoint returns HTTP 200.
* `dq-webapp` logs show no Flyway version mismatch errors.
* `dq-agent` pod is `Running` and its log shows a successful connection to the Metastore.
* The agent appears as `ACTIVE` in the `agent` table in the Metastore.
* A test job submits successfully and reaches `FINISHED` status in `agent_q`.
* The scheduler picks up and runs a scheduled job (check the `job_schedule_attempt` table).
* The UI loads and displays historical findings correctly.
