Skip to content

kx delete

Deletes one or more indexed resources, confirming each one individually — so declining one doesn’t take the rest with it — unless --yes skips every prompt.

kubectl’s own flags pass through: --force --grace-period=0 for a pod that will not go, --cascade=orphan, --wait=false, --dry-run. A --dry-run still prompts — kx does not read kubectl’s flag semantics, and reading --dry-run=none as a dry run would skip the prompt on a real delete.

A flag kx doesn’t know is refused; put it after -- to pass it through to kubectl.

Usage

kx delete [OPTIONS] <index>... [kubectl flags]

Arguments

ArgumentDescription
<index>...Row number from the current listing, or @name for a mark; kx state or kx mark shows them

Options

OptionDescription
--dry-run[=string]client or server to preview the change without making it, as kubectl takes it; kx’s line says nothing was changed
-o, --output stringOutput format, as kubectl takes it; kubectl’s output is printed, and kx’s own lines go to stderr
-y, --yesSkip the confirmation prompt

Passthrough options

OptionDescription
--allDelete all resources, in the namespace of the specified resource types.
-A, --all-namespacesIf present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
--cascade[=string]Must be “background”, “orphan”, or “foreground”. Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.
--field-selector stringSelector (field query) to filter on, supports ‘=’, ‘==’, and ‘!=’.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.
-f, --filename stringscontaining the resource to delete.
--forceIf true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.
--grace-period intPeriod of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).
--ignore-not-foundTreat “resource not found” as a successful delete. Defaults to “true” when --all is specified.
-i, --interactiveIf true, delete resource only when user confirms.
-k, --kustomize stringProcess a kustomization directory. This flag can’t be used together with -f or -R.
--nowIf true, resources are signaled for immediate shutdown (same as --grace-period=1).
--raw stringRaw URI to DELETE to the server. Uses the transport specified by the kubeconfig file.
-R, --recursiveProcess the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
-l, --selector stringSelector (label query) to filter on, supports ‘=’, ‘==’, ‘!=’, ‘in’, ’notin’.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.
--timeout durationThe length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object
--waitIf true, wait for resources to be gone before returning. This waits for finalizers.
…kubectl’s global flags too: --context, --kubeconfig, --as and the rest; kubectl options lists them

Global options

OptionDescription
--no-colorDisable styled output
-h, --helpShow this message and exit

Examples

kx delete 3
kx delete 3 5 -y
kx delete 3..5
kx delete 3..
kx delete 3 --force --grace-period=0