mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * applications/pruning-objects.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="pruning-deployments_{context}"]
|
|
= Pruning deployment resources
|
|
|
|
You can prune resources associated with deployments that are no longer required by the system, due to age and status.
|
|
|
|
The following command prunes replication controllers associated with `DeploymentConfig` objects:
|
|
|
|
[source,terminal]
|
|
----
|
|
$ oc adm prune deployments [<options>]
|
|
----
|
|
|
|
[NOTE]
|
|
====
|
|
To also prune replica sets associated with `Deployment` objects, use the `--replica-sets` flag. This flag is currently a Technology Preview feature.
|
|
====
|
|
|
|
.`oc adm prune deployments` flags
|
|
[cols="4,8a",options="header"]
|
|
|===
|
|
|
|
|Option |Description
|
|
|
|
.^|`--confirm`
|
|
|Indicate that pruning should occur, instead of performing a dry-run.
|
|
|
|
.^|`--keep-complete=<N>`
|
|
|Per the `DeploymentConfig` object, keep the last `N` replication controllers that have a status of `Complete` and replica count of zero. The default is `5`.
|
|
|
|
.^|`--keep-failed=<N>`
|
|
|Per the `DeploymentConfig` object, keep the last `N` replication controllers that have a status of `Failed` and replica count of zero. The default is `1`.
|
|
|
|
.^|`--keep-younger-than=<duration>`
|
|
|Do not prune any replication controller that is younger than `<duration>` relative to the current time. Valid units of measurement include nanoseconds (`ns`), microseconds (`us`), milliseconds (`ms`), seconds (`s`), minutes (`m`), and hours (`h`). The default is `60m`.
|
|
|
|
.^|`--orphans`
|
|
|Prune all replication controllers that no longer have a `DeploymentConfig` object, has status of `Complete` or `Failed`, and has a replica count of zero.
|
|
|
|
ifndef::openshift-rosa,openshift-dedicated[]
|
|
.^|`--replica-sets=true\|false`
|
|
|If `true`, replica sets are included in the pruning process. The default is `false`.
|
|
|
|
[IMPORTANT]
|
|
====
|
|
This flag is a Technology Preview feature.
|
|
====
|
|
endif::openshift-rosa,openshift-dedicated[]
|
|
|===
|
|
|
|
.Procedure
|
|
|
|
. To see what a pruning operation would delete, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
|
|
--keep-younger-than=60m
|
|
----
|
|
|
|
. To actually perform the prune operation, add the `--confirm` flag:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
|
|
--keep-younger-than=60m --confirm
|
|
----
|