-
Notifications
You must be signed in to change notification settings - Fork 101
Document deleting orphaned Kubernetes objects #3413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flin-8
wants to merge
12
commits into
main
Choose a base branch
from
frank/pruning-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f2d63b6
Everything but new page
flin-8 bc8251e
wer
flin-8 16879cc
fd
flin-8 382dcda
fd
flin-8 da45408
img
flin-8 d5d6c08
Fix trailing whitespace and comma splice in the orphan detection note
flin-8 452e9db
trailing lf
flin-8 ce4cb01
better screenshot
flin-8 b5cb7f1
colour
flin-8 984d6de
WIP
flin-8 9a5518b
Versions
flin-8 eee54fb
date & lint
flin-8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+334 KB
public/docs/img/kubernetes/live-object-status/live-status-orphaned-objects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/pages/docs/kubernetes/live-object-status/deleting-orphaned-objects.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| --- | ||
| layout: src/layouts/Default.astro | ||
| pubDate: 2026-08-19 | ||
| modDate: 2026-08-24 | ||
| navSection: Deleting orphaned objects | ||
| title: Deleting orphaned objects | ||
| navTitle: Deleting orphaned objects | ||
| description: How to review and delete Kubernetes objects that Octopus no longer deploys but that are still running in your cluster. | ||
| navOrder: 60 | ||
| --- | ||
|
|
||
| When a deployment stops including an object that a previous release deployed, Octopus marks that object as **Orphaned** in Kubernetes Live Object Status, and it keeps running in your cluster until someone removes it. Octopus can delete orphaned objects for you, one at a time or in bulk, from the project's Live Status page. | ||
|
|
||
| ## Requirements | ||
|
|
||
| To delete orphaned objects you need: | ||
|
|
||
| - The `DeployedResourceAdminister` permission for the project, environment, and tenant you are deleting in | ||
| - A Kubernetes agent whose service account is allowed to delete the objects in question | ||
| - Objects reported by the [Kubernetes monitor](/docs/kubernetes/targets/kubernetes-agent/kubernetes-monitor). Objects observed through Argo CD are never orphaned and cannot be deleted this way | ||
|
|
||
| ## Delete orphaned objects | ||
|
|
||
| Open your project and select **Live Status** for the environment (and tenant) you want. The table offers a delete action on every orphaned row, and when an application has orphaned objects the page also shows a card counting them. To list only orphaned objects, use the **Sync status** filter and select **Orphaned**. | ||
|
|
||
| :::figure | ||
|  | ||
| ::: | ||
|
|
||
| ### A single object | ||
|
|
||
| 1. Open the row's **Resource actions** menu and choose **Review & delete**. | ||
| 2. Confirm in the **Delete orphaned resource** dialog by choosing **Delete**. | ||
|
|
||
| You can also select the object to open its detail drawer and use the **Delete** button there. | ||
|
|
||
| ### Several objects at once | ||
|
|
||
| 1. Choose **Review & delete** on the orphaned-objects card to open the **Delete orphaned resources** drawer. | ||
| 2. Select the objects to delete. Objects are grouped by deployment target, so you can select a whole target or everything at once. | ||
| 3. Choose **Next**. | ||
| 4. Review the **Confirm deletion** step, which lists every selected object grouped by deployment target. | ||
| 5. Choose **Delete**. | ||
|
|
||
| ## The deletion task | ||
|
|
||
| Each request queues one **Delete Kubernetes resources** task, which is linked from the Kubernetes resource being deleted. Deletion tasks can run at the same time as deployments. | ||
|
|
||
| The deletion task runs a script on the Kubernetes Agent that calls `kubectl delete` with a 5 minute timeout for each resource. If some objects delete and others don't, the task deletes everything it can, records every outcome, and then fails. | ||
|
|
||
| Octopus validates your selection when you confirm, and silently skips an object when: | ||
|
|
||
| - The object is no longer orphaned, most likely because a deployment re-added it. | ||
| - A deletion task for the object is already queued or running. | ||
| - The monitor no longer reports the object in the cluster, so there is nothing to delete. | ||
| - Status information for the object is stale, so Octopus cannot safely delete it. | ||
|
|
||
| ## Permissions | ||
|
|
||
| Deleting an orphaned object needs permission in two places: in Octopus, to request the deletion, and in your cluster, for the agent that carries it out. | ||
|
|
||
| ### Octopus permissions | ||
|
|
||
| Requesting a deletion requires the `DeployedResourceAdminister` permission ("Administer deployed resources managed by Octopus"), scoped to the project, environment, and tenant. It is included by default in the **Project Contributor**, **Project Deployer**, **Project Lead**, and **Space Manager** built-in roles. | ||
|
|
||
| ### Cluster permissions | ||
|
|
||
| Octopus deletes objects by running `kubectl delete` on the Kubernetes agent, so the deletion uses the **agent's** service account. Make sure that account is allowed to delete the kinds and namespaces you expect to clean up. When you use the [permissions controller](/docs/kubernetes/targets/kubernetes-agent/granular-permissions) to scope permissions per step, deletions run under the reserved step slug `octopus-kubernetes-resource-deletion`. | ||
|
|
||
| ## Auditing | ||
|
|
||
| Every deletion task writes one audit event to the **Audit** screen in **Configuration**, succeeded or failed, recorded against the user who requested it. Its details list every object with its outcome, grouped by deployment target, with failures first. | ||
|
|
||
| ## Known limitations | ||
|
|
||
| - Only top-level orphaned objects can be deleted. Child objects, such as Pods belonging to a Deployment can't be deleted from Octopus to restart a service. | ||
| - You cannot stop tracking an orphaned object without deleting it. If the object is still needed by something else, delete it and recreate it from a different project. | ||
|
|
||
| ## Version notes | ||
|
|
||
| - Deleting orphaned Kubernetes objects requires Octopus Server 2026.3.13597 and Kubernetes agent version 2.38.3 or later (v2) / 3.0.1 or later (v3). | ||
|
|
||
| ## Learn more | ||
|
|
||
| - [Kubernetes Live Object Status](/docs/kubernetes/live-object-status) | ||
| - [Orphaned objects](/docs/kubernetes/live-object-status#orphaned-objects) | ||
| - [Troubleshooting Live Object Status](/docs/kubernetes/live-object-status/troubleshooting) | ||
| - [Kubernetes agent permissions controller](/docs/kubernetes/targets/kubernetes-agent/granular-permissions) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a screenshot without names etc.