kubernetes: Unable to delete stale objects with `kubectl apply --prune` when no object passed in.
What keywords did you search in Kubernetes issues before filing this one? kubectl apply prune
Is this a BUG REPORT or FEATURE REQUEST? (FEATURE REQUEST):
Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.3823+8444d47627df7d-dirty", GitCommit:"8444d47627df7d120c1641a3fe841480e10cb766", GitTreeState:"dirty", BuildDate:"2017-01-25T01:02:18Z", GoVersion:"go1.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.4057+b3f9be4656fe35-dirty", GitCommit:"b3f9be4656fe35642ea26271476cf79a349008e1", GitTreeState:"dirty", BuildDate:"2017-01-27T17:01:55Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
What happened:
I created a bunch of objects with:
kubectl apply -f /objects/folder -l test=true
I then deleted one of the yaml files in /objects/folder and execute below:
$ kubectl apply -f /objects/folder -l test=true --prune
...
pod "jessie2" pruned
...
The corresponding object is pruned as expected. I continue to delete all yaml files in /objects/folder and execute the same command again:
$ kubectl apply -f /objects/folder -l test=true --prune
error: no objects passed to apply
kubectl apply --prune is unable to remove the corresponding objects from the delete files.
What you expected to happen:
kubectl apply --prune would be able to remove the corresponding objects when all yaml files are deleted.
How to reproduce it:
Please see “What happened section” above.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 26 (13 by maintainers)
Bumping that this issue is one we’re interested in. Use case is in https://github.com/kubernetes/kubernetes/issues/57916