Skip to content

Add --cascade or --force flag to kubectl delete namespace, for non-empty namespaces #525

@johanot

Description

@johanot

Today, if you drain a node, kubectl will prompt you for confirmation in the form of --ignore-daemonsets and --delete-local-data if applicable. This is fine and a nice guard for doing something dangerous.

Along the same lines, I would like some sort of --force or --cascade flag for deleting namespaces, in case the namespace contains objects. This would imply kubectl get -n <namespace> all before the actual delete is executed.

/kind feature
/sig cli

What happened:
My namespace and all objects within it was deleted without confirmation or questioning.

What you expected to happen:
A warning or bail out asking for a confirmation or a "I-know-what-I'm-doing-flag` before proceeding.

How to reproduce it (as minimally and precisely as possible):
kubectl delete ns <any-namespace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kubectlkind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions