@@ -21,18 +21,21 @@ your own.
21
21
22
22
When you create a resource using a manifest file, you can specify finalizers in
23
23
the ` metadata.finalizers ` field. When you attempt to delete the resource, the
24
- controller that manages it notices the values in the ` finalizers ` field and does
25
- the following:
24
+ API server handling the delete request notices the values in the ` finalizers ` field
25
+ and does the following:
26
26
27
27
* Modifies the object to add a ` metadata.deletionTimestamp ` field with the
28
28
time you started the deletion.
29
- * Marks the object as read-only until its ` metadata.finalizers ` field is empty.
29
+ * Prevents the object from being removed until its ` metadata.finalizers ` field is empty.
30
+ * Returns a ` 202 ` status code (HTTP "Accepted")
30
31
32
+ The controller managing that finalizer notices the update to the object setting the
33
+ ` metadata.deletionTimestamp ` , indicating deletion of the object has been requested.
31
34
The controller then attempts to satisfy the requirements of the finalizers
32
35
specified for that resource. Each time a finalizer condition is satisfied, the
33
36
controller removes that key from the resource's ` finalizers ` field. When the
34
- field is empty, garbage collection continues. You can also use finalizers to
35
- prevent deletion of unmanaged resources.
37
+ ` finalizers ` field is emptied, an object with a ` deletionTimestamp ` field set
38
+ is automatically deleted. You can also use finalizers to prevent deletion of unmanaged resources.
36
39
37
40
A common example of a finalizer is ` kubernetes.io/pv-protection ` , which prevents
38
41
accidental deletion of ` PersistentVolume ` objects. When a ` PersistentVolume `
@@ -63,16 +66,18 @@ Kubernetes also processes finalizers when it identifies owner references on a
63
66
resource targeted for deletion.
64
67
65
68
In some situations, finalizers can block the deletion of dependent objects,
66
- which can cause the targeted owner object to remain in a read-only state for
69
+ which can cause the targeted owner object to remain for
67
70
longer than expected without being fully deleted. In these situations, you
68
71
should check finalizers and owner references on the target owner and dependent
69
72
objects to troubleshoot the cause.
70
73
71
74
{{<note >}}
72
- In cases where objects are stuck in a deleting state, try to avoid manually
75
+ In cases where objects are stuck in a deleting state, avoid manually
73
76
removing finalizers to allow deletion to continue. Finalizers are usually added
74
77
to resources for a reason, so forcefully removing them can lead to issues in
75
- your cluster.
78
+ your cluster. This should only be done when the purpose of the finalizer is
79
+ understood and is accomplished in another way (for example, manually cleaning
80
+ up some dependent object).
76
81
{{</note >}}
77
82
78
83
## {{% heading "whatsnext" %}}
0 commit comments