Uninstalling the Operator

How to uninstall the Altinity Kubernetes Operator for ClickHouse®

To remove the Altinity Kubernetes Operator for ClickHouse®, you first need to delete the ClickHouse resources you created with it. With that done, you can uninstall the operator.

Deleting the ClickHouse resources

Before deleting the operator, you need to delete the ClickHouse resources you created with it.

If you used ClickHouse Keeper (you created a chk resource) with the name clickhouse-keeper:

kubectl delete chk clickhouse-keeper -n operator

If you installed Zookeeper via a YAML file, delete that resource:

kubectl delete -f https://raw.githubusercontent.com/Altinity/clickhouse-operator/release-0.25.2/deploy/zookeeper/zookeeper-manually/quick-start-persistent-volume/zookeeper-3-nodes.yaml -n operator

With the Keeper deleted, now delete the chi (named cluster01 in this example):

kubectl delete chi cluster01 -n operator

This will take a few minutes. When the command is complete, you’re ready to delete the operator.

Deleting the operator

Deleting the operator depends on how you installed it.

If you installed the operator with Helm

If you installed the operator with Helm, uninstalling it is trivial:

helm uninstall clickhouse-operator -n operator

The kubectl get crd command will show you that the CustomResourceDefinitions weren’t deleted. You can delete them with these commands:

kubectl delete crd clickhouseinstallations.clickhouse.altinity.com
kubectl delete crd clickhouseinstallationtemplates.clickhouse.altinity.com
kubectl delete crd clickhousekeeperinstallations.clickhouse-keeper.altinity.com
kubectl delete crd clickhouseoperatorconfigurations.clickhouse.altinity.com

If you installed the operator with kubectl

If you used a shell script that used kubectl to create a namespace and install the operator, run this command:

curl -s https://raw.githubusercontent.com/Altinity/clickhouse-operator/refs/heads/0.25.2/deploy/operator-web-installer/clickhouse-operator-delete.sh | OPERATOR_NAMESPACE=operator bash

This example is for operator version 0.25.2; if you used a different version of the install script, use the corresponding version of the delete script.

The script will delete your namespace:

Delete ClickHouse Operator namespace operator
namespace "operator" deleted

The kubectl get crd command will show you that the CustomResourceDefinitions weren’t deleted. You can delete them with these commands:

kubectl delete crd clickhouseinstallations.clickhouse.altinity.com
kubectl delete crd  clickhouseinstallationtemplates.clickhouse.altinity.com
kubectl delete crd clickhousekeeperinstallations.clickhouse-keeper.altinity.com
kubectl delete crd clickhouseoperatorconfigurations.clickhouse.altinity.com