Uninstall istio (all components) completely from kubernetes cluster

17,061

Solution 1

If you used istioctl, it's pretty easy:

istioctl x uninstall --purge

Of course, it would be easier if that command were listed in istioctl --help...

Reference: https://istio.io/latest/docs/setup/install/istioctl/#uninstall-istio

Solution 2

Based on their documentation here, you can generate all specs as yml file then pipe it to simple kubectl's delete operation

istioctl manifest generate <your original installation options> | kubectl delete -f -

here's an example:

istioctl manifest generate --set profile=default | kubectl delete -f -

A drawback of this approach though is to remember all options you have used when you installed istio which might be quite hard to remember especially if you enabled specific components.

If you have installed istio using helm's chart, you can uninstall it easily

First, list all installed charts:

helm list -n istio-system
NAME    NAMESPACE   REVISION    UPDATED                                 STATUS   
istiod  istio-system    1       2020-03-07 15:01:56.141094 -0500 EST    deployed   

and then delete/uninstall the chart using the following syntax:

helm delete -n istio-system --purge istio-system
helm delete -n istio-system --purge istio-init
...

Check their website for more information on how to do this.

If you already installed istio using istioctl or helm in its own separate namespace, you can easily delete completely that namespace which will in turn delete all resources created inside it.

kubectl delete namespace istio-system 

Solution 3

Just run kubectl delete for the files you applied.

kubectl delete -f istio-$(VERSION)/install/kubernetes/istio-demo-auth.yaml

You can find this in docs as well.

Solution 4

If you have installed it as described, then you will need to delete it in the same way.

kubectl delete -f istio-$(VERSION)/install/kubernetes/helm/istio/templates/crds.yaml
kubectl delete -f istio-$(VERSION)/install/kubernetes/istio-demo-auth.yaml

Then you would manually delete the folder, and istioctl, if you moved to anywhere.

IMPORTANT: Deleting a namespace is super comfortable to clean up, but you can't do it for all scenarios. In this situation, if you delete the namespace only, you are leaving all the permissions and credentials intact. Now, say you want to update Istio, and Istio team has made some security changes in their RBAC rules, but has not changed the name of the object. You would deploy the new yaml file, and it will throw an error saying the object (for example clusterrolebinding) already exists. If you don't pay attention to what that error was, you can end up with the worse type of errors (when there are no error, but something goes wrong).

Solution 5

Cleaning up Istio is a bit tricky, because of all the things it adds: CustomResourceDefinitions, ConfigMaps, MutatingWebhookConfigurations, etc. Just deleting the istio-system namespace is not sufficient. The safest bet is to use the uninstall instructions from istio.io for the method you used to install.

Kubectl: https://istio.io/docs/setup/kubernetes/install/kubernetes/#uninstall

Helm: https://istio.io/docs/setup/kubernetes/install/helm/#uninstall

When performing these steps, use the version of Istio you are attempting to remove. So if you are trying to remove Istio 1.0.2, grab that release from istio.io.

Share:
17,061
user674669
Author by

user674669

Updated on June 08, 2022

Comments

  • user674669
    user674669 about 2 years

    I installed istio using these commands:

    VERSION = 1.0.5
    GCP = gcloud
    K8S = kubectl
    
    @$(K8S) apply -f istio-$(VERSION)/install/kubernetes/helm/istio/templates/crds.yaml
    @$(K8S) apply -f istio-$(VERSION)/install/kubernetes/istio-demo-auth.yaml
    @$(K8S) get pods -n istio-system
    @$(K8S) label namespace default istio-injection=enabled
    @$(K8S) get svc istio-ingressgateway -n istio-system
    

    Now, how do I completely uninstall it including all containers/ingress/egress etc (everthing installed by istio-demo-auth.yaml?

    Thanks.

  • CashIsClay
    CashIsClay almost 4 years
    Istio CRDs are installed through a Job+ConfigMap so this will not remove them.