I ran into this today. I hit the “Destroy” button in Okteto expecting a clean reset of my environment, and it wiped out all resources, even when ones that were not displayed in the UI (e.g. a volume snapshot)
How do I prevent that?
I ran into this today. I hit the “Destroy” button in Okteto expecting a clean reset of my environment, and it wiped out all resources, even when ones that were not displayed in the UI (e.g. a volume snapshot)
How do I prevent that?
If you’re using Okteto and hit the “Destroy All” button (or run the okteto destroy --all), you might be surprised to see important Kubernetes resources disappear along with everything else.
Here’s how to prevent that ![]()
Destroy All (okteto destroy --all) is designed to clean up everything in your namespace:
That’s great for cleanup… but not if you have shared or persistent resources (like secrets, databases, or config maps) you want to keep.
Annotate any resource you want to preserve with:
metadata:
annotations:
dev.okteto.com/policy: keep
apiVersion: v1
kind: Secret
metadata:
name: my-important-secret
annotations:
dev.okteto.com/policy: keep
With this annotation in place, Okteto will skip deleting this resource during Destroy All.
This is especially useful for:
Be intentional about what you mark as keep. If overused, your environment can drift from a clean state.
Simple trick, but it can save you from painful data loss ![]()