title | sidebar_position |
---|---|
Handling Deletion Errors |
3 |
In this example, we will again deploy the Helm chart of the hello-world example and then delete it. During the deletion, an error will be provoked by removing the target before the deletion happened.
For prerequisites, see here.
First create the Target and the Installation again:
-
Insert the kubeconfig of your target cluster into your target.yaml.
-
On the Landscaper resource cluster, create namespace
example
and apply the target.yaml and the installation.yaml:kubectl create ns example kubectl apply -f <path to target.yaml> kubectl apply -f <path to installation.yaml>
In the next step, delete the target my-cluster
:
kubectl delete target -n example my-cluster
Now, when we try to delete the Installation, there is no access information for the target cluster available from where the Helm chart should be removed. This will lead to a failing deletion of the Installation:
kubectl delete installation -n example hello-world
It will take some time until the timeout occurs and the Installation fails, i.e. phase: DeletionFailed
is being reached. You can speed this up by setting the interrupt annotation (as described in more detail in the previous example):
kubectl annotate installation -n example hello-world landscaper.gardener.cloud/operation=interrupt
For prerequisites, see.
The usual way to resolve this failed Deletion is to recreate the target and re-trigger the deletion of the installation by setting the reconcile
annotation:
kubectl apply -f <path to target.yaml>
kubectl annotate installation -n example hello-world landscaper.gardener.cloud/operation=reconcile
Now the installation should be gone and the deployed Helm chart should be uninstalled.
If for some reason it is not possible to resolve the problems as described above and it is ok that the deployed Helm chart is not uninstalled automatically, you could use the landscaper-cli to remove the installation. This is the preferred solution if the target cluster does not exist anymore. You can achieve this with the following command:
landscaper-cli installations force-delete -n example hello-world
Note: It is not recommended to use this approach if you have a successful Installation and want to remove just the Installation, without uninstalling the deployed components on the target cluster. In such a situation, the annotation
landscaper.gardener.cloud/delete-without-uninstall: true
should be used.