Deleting Managed ClickHouse® Environments in Kubernetes

Deleting your ClickHouse® cluster

You can simply disconnect your ClickHouse® cluster from Altinity.Cloud without disturbing your ClickHouse cluster or its data. If that’s what you want to do, see the cluster disconnection instructions.

There’s a second option: you can delete the Altinity.Cloud environment, not the ClickHouse cluster. That takes away Altinity’s access without disturbing your ClickHouse cluster or its data. (See the topic Delete the environment, but leave your ClickHouse clusters undisturbed for complete details.)

But you can also delete your ClickHouse cluster.

If you’ve thought it through and you really want to delete the ClickHouse clusters in your environment, enter these two commands in this order:

kubectl -n altinity-cloud-managed-clickhouse delete chi --all
altinitycloud-connect kubernetes | kubectl delete -f -

The first command deletes every ClickHouse installation (chi) that Altinity.Cloud Anywhere created. Those are in the altinity-cloud-managed-clickhouse namespace. With the ClickHouse clusters deleted, the second command deletes the two Altinity namespaces and any remaining resources they contain.

WARNING: If you delete the namespaces before deleting the ClickHouse installations (chi), the operation will hang due to missing finalizers on chi resources. Should this occur, use the kubectl edit command on each ClickHouse installation and remove the finalizer manually from the resource specification. Here is an example:

 kubectl -n altinity-cloud-managed-clickhouse edit clickhouseinstallations.clickhouse.altinity.com/maddie-ch

You can now delete the finalizer from the resource:

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
  creationTimestamp: "2023-08-29T17:03:58Z"
  finalizers:
  - finalizer.clickhouseinstallation.altinity.com
  generation: 3
  name: maddie-ch
  
. . .