Skip to content

Commit 018191a

Browse files
authored
Merge pull request #31737 from liggitt/patch-3
Update finalizers.md
2 parents 85438bf + fa4cc59 commit 018191a

File tree

1 file changed

+13
-8
lines changed
  • content/en/docs/concepts/overview/working-with-objects

1 file changed

+13
-8
lines changed

content/en/docs/concepts/overview/working-with-objects/finalizers.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@ your own.
2121

2222
When you create a resource using a manifest file, you can specify finalizers in
2323
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:
2626

2727
* Modifies the object to add a `metadata.deletionTimestamp` field with the
2828
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")
3031

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.
3134
The controller then attempts to satisfy the requirements of the finalizers
3235
specified for that resource. Each time a finalizer condition is satisfied, the
3336
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.
3639

3740
A common example of a finalizer is `kubernetes.io/pv-protection`, which prevents
3841
accidental deletion of `PersistentVolume` objects. When a `PersistentVolume`
@@ -63,16 +66,18 @@ Kubernetes also processes finalizers when it identifies owner references on a
6366
resource targeted for deletion.
6467

6568
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
6770
longer than expected without being fully deleted. In these situations, you
6871
should check finalizers and owner references on the target owner and dependent
6972
objects to troubleshoot the cause.
7073

7174
{{<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
7376
removing finalizers to allow deletion to continue. Finalizers are usually added
7477
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).
7681
{{</note>}}
7782

7883
## {{% heading "whatsnext" %}}

0 commit comments

Comments
 (0)