Uninstall
To remove the Altinity Kubernetes Operator for ClickHouse®, both the operator and the components in its installed namespace will have to be removed. The proper command is to uses the same clickhouse-operator-install-bundle.yaml
file that was used to install the operator. See the installation instructions for more information.
The following instructions are based on the standard installation instructions. For users who perform a custom installation, note that the any custom namespaces that the user wants to remove will have to be deleted separate from the operator deletion.
For example, if the custom namespace operator-test
is created, then it would be removed with the command kubectl delete namespaces operator-test
.
IMPORTANT NOTICE 1
Never delete the operator or run the following command while there are live ClickHouse clusters managed by the operator:
kubectl delete --namespace "kube-system" -f https://github.com/Altinity/clickhouse-operator/raw/0.18.3/deploy/operator/clickhouse-operator-install-bundle.yaml
The command will hang due to the live clusters. If you then re-install the operator, those clusters will be deleted and the operator will not work correctly.
See Issue #830 in the Altinity/clickhouse-operator repo for more details.
IMPORTANT NOTICE 2
Please follow the instructions below. The uninstall command is geared to properly remove the operator and its namespace. Deleting the namespace without properly removing the operator can cause it to hang.Instructions
To remove the operator from your Kubernetes environment from a standard install:
-
Verify the operator is in the
kube-system
namespace. The operators pods and other pods will be displayed:NAME READY STATUS RESTARTS AGE clickhouse-operator-857c69ffc6-2frgl 2/2 Running 0 5s coredns-78fcd69978-nthp2 1/1 Running 4 (23h ago) 51d etcd-minikube 1/1 Running 4 (23h ago) 51d kube-apiserver-minikube 1/1 Running 4 (23h ago) 51d kube-controller-manager-minikube 1/1 Running 4 (23h ago) 51d kube-proxy-lsggn 1/1 Running 4 (23h ago) 51d kube-scheduler-minikube 1/1 Running 4 (23h ago) 51d storage-provisioner 1/1 Running 9 (23h ago) 51d
-
Issue the
kubectl
delete command using the same YAML file used to install the operator. By default the operator is installed in the namespacekube-system
. If this was installed into a custom namespace, verify that it installed in the uninstall command. In this example, we specified an installation of the operator version0.18.3
into the defaultkube-system
namespace. This produces output similar to the following:kubectl delete -f https://github.com/Altinity/clickhouse-operator/raw/0.18.3/deploy/operator/clickhouse-operator-install-bundle.yaml
customresourcedefinition.apiextensions.k8s.io "clickhouseinstallations.clickhouse.altinity.com" deleted customresourcedefinition.apiextensions.k8s.io "clickhouseinstallationtemplates.clickhouse.altinity.com" deleted customresourcedefinition.apiextensions.k8s.io "clickhouseoperatorconfigurations.clickhouse.altinity.com" deleted serviceaccount "clickhouse-operator" deleted clusterrole.rbac.authorization.k8s.io "clickhouse-operator-kube-system" deleted clusterrolebinding.rbac.authorization.k8s.io "clickhouse-operator-kube-system" deleted configmap "etc-clickhouse-operator-files" deleted configmap "etc-clickhouse-operator-confd-files" deleted configmap "etc-clickhouse-operator-configd-files" deleted configmap "etc-clickhouse-operator-templatesd-files" deleted configmap "etc-clickhouse-operator-usersd-files" deleted deployment.apps "clickhouse-operator" deleted service "clickhouse-operator-metrics" deleted
-
To verify the operator has been removed, use the
kubectl get namespaces
command:kubectl get pods --namespace kube-system
NAME READY STATUS RESTARTS AGE coredns-78fcd69978-nthp2 1/1 Running 4 (23h ago) 51d etcd-minikube 1/1 Running 4 (23h ago) 51d kube-apiserver-minikube 1/1 Running 4 (23h ago) 51d kube-controller-manager-minikube 1/1 Running 4 (23h ago) 51d kube-proxy-lsggn 1/1 Running 4 (23h ago) 51d kube-scheduler-minikube 1/1 Running 4 (23h ago) 51d storage-provisioner 1/1 Running 9 (23h ago) 51d