Deleting the Stackable Trino Taxi Data Demo
I recently tried out the Trino Taxi Data Demo from Stackable.tech and was quite impressed. However, it broke a few times on installation and I had to delete it and start again a few times.
I am not sure there is a good way of deleting stuff in Kubernetes, but here is my attempt which seemed to work fine for me. If you have any fine tuning then please speak up.
[EDITED 11 Dec 2023 to add more helm commands]
Prerequisites
I am using kubectl to access my Kubernetes cluster, and a flavour of Linux.
We are assuming that you don’t want to entirely delete your Kubernetes cluster, though that might be an acceptable solution.
Installation Scripts
Here is my script (02_get_stackablectl.sh) to get the stackablectl command and drop it in my ~/bin which I already have in my PATH. This was copied from the docs.
#!/bin/sh -x
echo See https://docs.stackable.tech/management/stable/stackablectl/installation
wget -O stackablectl https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-23.11.0/stackablectl-x86_64-unknown-linux-gnu
# or
# curl -L -o stackablectl https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-23.11.0/stackablectl-x86_64-unknown-linux-gnu
chmod +x stackablectl
mv stackablectl ~/bin
[EDIT 12 Dec 2023 -it seems like this version is no longer the latest one. Please check and amend your command as appropriate]
Also the script (04_install_demo_taxi_data.sh) to actually install the demo is copied from the docs
#!/bin/sh -x
stackablectl demo install trino-taxi-data
And also a script (05_check_installed.sh) containing two commands from the docs to see what got installed.
#!/bin/sh -x
stackablectl operator installed
stackablectl stacklet list
Note that the docs say “stacklets” but that seems to be a mistake. [EDIT: They changed it to be consistently singular, but didn’t change all the docs] A successful deployment looks something like this.
$ ./05_check_installed.sh
+ stackablectl operator installed
┌───────────────────┬─────────┬─────────────────────┬──────────┬─────────────────────────────────────────┐
│ OPERATOR ┆ VERSION ┆ NAMESPACE ┆ STATUS ┆ LAST UPDATED │
╞═══════════════════╪═════════╪═════════════════════╪══════════╪═════════════════════════════════════════╡
│ commons-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:46:49.482238609 +0000 UTC │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hive-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:47:16.653866461 +0000 UTC │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ opa-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:47:35.910849551 +0000 UTC │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ secret-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:47:55.040764454 +0000 UTC │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ superset-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:47:58.608350529 +0000 UTC │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ trino-operator ┆ 23.11.0 ┆ stackable-operators ┆ deployed ┆ 2023-12-01 17:49:02.803529623 +0000 UTC │
└───────────────────┴─────────┴─────────────────────┴──────────┴─────────────────────────────────────────┘
Use "stackablectl operator install [OPTIONS] <OPERATORS>..." to install one or more additional operators.
Use "stackablectl operator uninstall [OPTIONS] <OPERATORS>..." to uninstall one or more operators.
+ stackablectl stacklet list
┌──────────┬───────────────┬───────────┬────────────────────────────────────────────────┬─────────────────────────────────┐
│ PRODUCT ┆ NAME ┆ NAMESPACE ┆ ENDPOINTS ┆ CONDITIONS │
╞══════════╪═══════════════╪═══════════╪════════════════════════════════════════════════╪═════════════════════════════════╡
│ hive ┆ hive ┆ default ┆ ┆ Available, Reconciling, Running │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ opa ┆ opa ┆ default ┆ ┆ Available, Reconciling, Running │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ superset ┆ superset ┆ default ┆ external-http http://192.168.1.74:31827 ┆ Available, Reconciling, Running │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ trino ┆ trino ┆ default ┆ coordinator-metrics 192.168.1.75:31531 ┆ Available, Reconciling, Running │
│ ┆ ┆ ┆ coordinator-https https://192.168.1.75:32662 ┆ │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ minio ┆ minio-console ┆ default ┆ http http://192.168.1.75:31403 ┆ │
└──────────┴───────────────┴───────────┴────────────────────────────────────────────────┴─────────────────────────────────┘
Use "stackablectl stacklet credentials [OPTIONS] <PRODUCT_NAME> <STACKLET_NAME>" to display credentials for deployed stacklets.
In reality, you may find that something did not work in your environment. You can try to fix it and rerun the 04_install_demo_taxi_data.sh command as often as you want — but eventually you may decide you will need to start from scratch
Uninstalling
I am not 100% sure this is the best order of doing things — and also it only applies to one demo — you need to check every command carefully to confirm it is not deleting something you want to keep.
In the following scripts, I mix up kubectl and helm commands to delete or uninstall things, as well as the commands to see if they genuinely have gone.
[Edit to add more helm info]
The first thing to do is to delete the stuff helm has installed. Ideally if we get this right helm should uninstall everything itself. But of course life is never that easy.
# what does helm know about?
helm list
helm list -n stackable-operators
# and then lots of commands like
helm -n stackable-operators uninstall airflow-operator druid-operator nifi-operator
helm -n stackable-operators uninstall spark-k8s-operator superset-operator
helm uninstall minio postgresql-hive postgresql-superset
#!/bin/sh -x
helm list
helm uninstall minio postgresql-hive postgresql-superset
kubectl delete statefulsets superset-node-default
kubectl delete statefulsets trino-coordinator-default
kubectl delete statefulsets hive-metastore-default
kubectl get statefulsets
echo now trying to delete all the services
kubectl delete service hive
kubectl delete service hive-metastore-default
kubectl delete service opa
kubectl delete service opa-server-default
kubectl delete service spark-pi-ui-svc
kubectl delete service superset-external
kubectl delete service superset-node-default
kubectl delete service trino-coordinator
kubectl delete service trino-coordinator-default
kubectl delete service trino-worker-default
kubectl get service
echo Now deleteing the daemonset
kubectl delete -n default daemonset opa-server-default
And
#!/bin/sh -x
echo If you see an error that something is not found then that
echo probably is not an error, you just deleted it already and it
echo cannot delete it a second time
echo Your helm list should be empty of any stackable entries
helm list
kubectl delete serviceaccount superset-serviceaccount
kubectl delete serviceaccount hive-serviceaccount
kubectl delete serviceaccount opa-serviceaccount
kubectl delete serviceaccount superset-sa
kubectl delete serviceaccount trino-serviceaccount
kubectl get serviceaccount
kubectl delete crds authenticationclasses.authentication.stackable.tech
kubectl delete crds opaclusters.opa.stackable.tech
kubectl delete crds s3buckets.s3.stackable.tech
kubectl delete crds s3connections.s3.stackable.tech
kubectl delete crds secretclasses.secrets.stackable.tech
kubectl delete crds supersetclusters.superset.stackable.tech
kubectl delete crds supersetdbs.superset.stackable.tech
kubectl delete crds trinocatalogs.trino.stackable.tech
kubectl delete crds trinoclusters.trino.stackable.tech
kubectl delete crds druidconnections.superset.stackable.tech
kubectl delete crds hiveclusters.hive.stackable.tech
echo this should report only system custom resource definitions
echo and no stackable.tech ones
kubectl get crds
And
#!/bin/sh -x
echo If you see an error that something is not found then that
echo probably is not an error, you just deleted it already and it
echo cannot delete it a second time
kubectl delete deployments --namespace stackable-operators commons-operator-deployment
kubectl delete deployments --namespace stackable-operators hive-operator-deployment
kubectl delete deployments --namespace stackable-operators opa-operator-deployment
kubectl delete deployments --namespace stackable-operators superset-operator-deployment
kubectl delete deployments --namespace stackable-operators trino-operator-deployment
echo Should have no deployments in the stackable-operators namespace
kubectl get deployments --namespace stackable-operators
echo these should be terminating already
# kubectl delete pod --namespace stackable-operators --all
echo Deleting the jobs
kubectl delete job create-ny-taxi-data-table-in-trino
kubectl delete job load-ny-taxi-data
kubectl delete job setup-superset
echo this should report no Stackable jobs
kubectl get job
echo deleting the demonset
kubectl delete -n stackable-operators daemonset secret-operator-daemonset
Don’t ask why I missed out that one daemonset.
Here are the last few things I found which I also deleted. These will likely remain the same between different versions of the demo, but I thought it best to get rid of them anyway.
Note that sometimes I am deleting everything in the stackable namespace
--namespace stackable-operators --all
Be careful with this. I am happy deleting everything in the stackable-operators namespace, but one slip of the finger and you may be deleting much more.
#!/bin/sh -x
echo If you see an error that something is not found then that
echo probably is not an error, you just deleted it already and it
echo cannot delete it a second time
kubectl delete configmaps --namespace stackable-operators --all
echo Should have no configmaps in the stackable-operators namespace
kubectl get configmaps --namespace stackable-operators
echo Not sure why these are in default namespace and not a stackable one
kubectl delete configmaps create-ny-taxi-data-table-in-trino-script
kubectl delete configmaps setup-superset-script
kubectl delete configmaps trino-opa-bundle
kubectl delete clusterrolebinding commons-operator-clusterrolebinding
kubectl delete clusterrolebinding hive-operator-clusterrolebinding
kubectl delete clusterrolebinding opa-operator-clusterrolebinding
kubectl delete clusterrolebinding secret-operator-clusterrolebinding
kubectl delete clusterrolebinding superset-operator-clusterrolebinding
kubectl delete clusterrolebinding trino-operator-clusterrolebinding
kubectl delete clusterrole commons-operator-clusterrole
kubectl delete clusterrole hive-clusterrole
kubectl delete clusterrole hive-operator-clusterrole
kubectl delete clusterrole opa-clusterrole
kubectl delete clusterrole opa-operator-clusterrole
kubectl delete clusterrole opa-operator-opa-bundle-builder-clusterrole
kubectl delete clusterrole secret-operator-clusterrole
kubectl delete clusterrole superset-clusterrole
kubectl delete clusterrole superset-operator-clusterrole
kubectl delete clusterrole trino-clusterrole
kubectl delete clusterrole trino-operator-clusterrole
# delete all secrets
kubectl delete -n stackable-operators secret --all
kubectl delete -n default secret secret-provisioner-tls-ca
kubectl delete -n default secret superset-credentials
kubectl delete -n default secret superset-mapbox-api-key
kubectl delete -n default secret trino-users
kubectl delete -n default secret minio-s3-credentials
kubectl delete storageclass secrets.stackable.tech
kubectl delete -n stackable-operators serviceaccount --all
As I learn more about stackable and Kubernetes I may find better ways of doing this. But for now I am happy with this.
[Edited 7th December 2023 to add some feedback regarding stacklet and stacklets]
[EDITED 11 Dec 2023 to add more helm commands]
Credits:
Image of deployment diagram taken from Stackable ( https://docs.stackable.tech/home/stable/demos/trino-taxi-data ) Thanks.
Words and mistakes from Alex McLintock https://bit.ly/m/alexmclintock