Uninstall Consul

    Run the and manually remove resources that Helm does not delete.

    1. (Optional) If Consul is installed in a dedicated namespace, set the kubeConfig context to the consul namespace. Otherwise, subsequent commands will need to include -n consul.

    2. Run the helm uninstall <release-name> command and specify the release name you’ve installed Consul with, e.g.,:

      1. $ helm uninstall consul
      2. release "consul" uninstalled
      1. $ kubectl get pvc -l chart=consul-helm
      2. NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
      3. data-default-hashicorp-consul-server-0 Bound pvc-32cb296b-1213-11ea-b6f0-42010a8001db 10Gi RWO standard 17m
      4. $ kubectl delete pvc -l chart=consul-helm
      5. persistentvolumeclaim "data-default-hashicorp-consul-server-0" deleted
      6. persistentvolumeclaim "data-default-hashicorp-consul-server-1" deleted
      7. persistentvolumeclaim "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.

    3. If installing with ACLs enabled, you will need to then delete the ACL secrets:

    4. Ensure that the secrets you’re about to delete are all created by Consul and not created by another user with the word consul.

      1. $ kubectl get secret | grep consul | grep Opaque | awk '{print $1}' | xargs kubectl delete secret
      2. secret "consul-acl-replication-acl-token" deleted
      3. secret "consul-client-acl-token" deleted
      4. secret "consul-controller-acl-token" deleted
      5. secret "consul-federation" deleted
      6. secret "consul-mesh-gateway-acl-token" deleted
      7. secret "consul-gossip-encryption-key" deleted
      1. $ kubectl get serviceaccount consul-tls-init
      2. NAME SECRETS AGE
      3. consul-tls-init 1 47m

    Consul K8s CLI

    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 uninstallation preserves the secrets and PVCs that are provisioned by Consul on Kubernetes.

      In the following example, Consul will be uninstalled and the data removed without prompting you to verify the operations:

      1. $ consul-k8s uninstall -auto-approve=true -wipe-data=true

      Refer to the topic for details.