Issue the consul-k8s uninstall command to remove Consul on Kubernetes. You can specify the installation name, namespace, and data retention behavior using the applicable options. By default, the uninstall preserves the secrets and PVCs that are provisioned by Consul on Kubernetes.
$consul-k8s uninstall <OPTIONS>
$consul-k8s uninstall <OPTIONS>
In the following example, Consul will be uninstalled and the data removed without prompting you to verify the operations:
Run the helm uninstalland manually remove resources that Helm does not delete.
Although the Helm chart automates the deletion of CRDs upon uninstall, sometimes the finalizers tied to those CRDs may not complete because the deletion of the CRDs rely on the Consul K8s controller running. Ensure that previously created CRDs for Consul on Kubernetes are deleted, so subsequent installs of Consul on Kubernetes on the same Kubernetes cluster do not get blocked.
$kubectl delete crd --selector app=consul
$kubectl delete crd --selector app=consul
(Optional) If Consul is installed in a dedicated namespace, set the kubeConfig context to the consul namespace. Otherwise, subsequent commands will need to include --namespace consul.
After deleting the Helm release, you need to delete the PersistentVolumeClaim's
for the persistent volumes that store Consul's data. A bug in Helm prevents PVCs from being deleted. Issue the following commands:
$kubectl get pvc --selector="chart=consul-helm"NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEdata-default-hashicorp-consul-server-0 Bound pvc-32cb296b-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17mdata-default-hashicorp-consul-server-1 Bound pvc-32d79919-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17mdata-default-hashicorp-consul-server-2 Bound pvc-331581ea-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17m$kubectl delete pvc --selector="chart=consul-helm"persistentvolumeclaim "data-default-hashicorp-consul-server-0" deletedpersistentvolumeclaim "data-default-hashicorp-consul-server-1" deletedpersistentvolumeclaim "data-default-hashicorp-consul-server-2" deleted
$kubectl get pvc --selector="chart=consul-helm"NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEdata-default-hashicorp-consul-server-0 Bound pvc-32cb296b-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17mdata-default-hashicorp-consul-server-1 Bound pvc-32d79919-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17mdata-default-hashicorp-consul-server-2 Bound pvc-331581ea-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17m$kubectl delete pvc --selector="chart=consul-helm"persistentvolumeclaim "data-default-hashicorp-consul-server-0" deletedpersistentvolumeclaim "data-default-hashicorp-consul-server-1" deletedpersistentvolumeclaim "data-default-hashicorp-consul-server-2" deleted
NOTE: This will delete all data stored in Consul and it can't be
recovered unless you've taken other backups.
If installing with ACLs enabled, you will need to then delete the ACL secrets: