LinuxCommandLibrary

crane-delete

Delete tags or manifests in container registries

TLDR

Delete an image reference from its registry

$ crane delete [image_name]
copy

Display help
$ crane delete [[-h|--help]]
copy

SYNOPSIS

crane delete [resource_type] [flags]

PARAMETERS

--all
    Select all resources of the specified type.

--age duration
    Select resources older than the specified duration (e.g., '1h', '2d').

--annotation string
    Select resources with the specified annotation.

--label string
    Select resources with the specified label.

--namespace string
    Select resources in the specified namespace. If not specified, the current context's namespace is used.

--kubeconfig string
    Path to the kubeconfig file to use for CLI requests.

--context string
    The name of the kubeconfig context to use.

--selector string
    A label selector to filter on, supports '=', '==', and '!='.

DESCRIPTION

The crane-delete command is a utility that facilitates the deletion of Kubernetes resources based on various filtering criteria. Unlike standard `kubectl delete`, crane-delete offers advanced filtering capabilities, allowing users to target specific resources more efficiently, particularly in large or complex Kubernetes deployments. This tool streamlines resource management by enabling bulk deletion based on labels, annotations, namespaces, and even resource age. It is typically used to clean up stale resources, enforce resource quotas, or manage resources in a more automated way. It simplifies the process of removing outdated or unwanted Kubernetes objects without manually specifying each one.
crane-delete often integrates with other Crane tools for comprehensive Kubernetes management.

CAVEATS

Incorrect use of crane-delete can lead to unintended resource deletion, potentially disrupting applications. Always carefully review the selection criteria before executing the command. Exercise caution, especially when using the `--all` flag. Check you have the rights to delete resources.

EXAMPLES

1. Delete all pods older than 1 hour: crane delete pods --age 1h
2. Delete all deployments with the label 'environment=staging': crane delete deployments --label environment=staging
3. Delete all services in the 'test' namespace: crane delete services --namespace test --all

SEE ALSO

kubectl delete(1), kubectl get(1)

Copied to clipboard