Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 3, 2023 03:26 pm GMT

What does the error "cannot delete Pods with local storage" mean ?

While we are doing Kubernetes cluster updates, or we simply want to clean a node before deleting it, we can have the error "**cannot delete Pods with local storage".

$ kubectl drain node-1 --ignore-daemonsets...error: cannot delete Pods with local storage (use --delete-emptydir-data to override):

The solution is quite simple and is already noted in the error log. We just have to add the option --delete-emptydir-data to your command to make it work.

But what does it mean ?

Error explaination

This error want to show you that you have some pods (which are on the node you want to clean) have local storage as emptyDir.

apiVersion: v1kind: Podmetadata:  name: my-podspec:  containers:  - image: busybox    name: busybox    volumeMounts:    - mountPath: /data      name: my-volume  volumes:  - name: my-volume    emptyDir: {}

Using an emptyDir volume is something which must be understand to avoid this kind of issue.

An emptyDir volume only exists on the node where the related pod is. Contrary to the pods, it won't be moved to a new node, but it will be destroyed, before being recreated on the new node.
It means that all the data which are on the "old" node will be deleted.

It is for this reason that we must be conscious about what is an emptyDir volume. If you are using this for a database, you may be able to do something manually to extract the data and migrate it to the new node. But you won't be able to always do it. Some services using volumes doesn't have an "extract" feature.

So we can conclude that the error cannot delete Pod with local storage is more a "confirmation box" to let you know that you have local storage and it should be extracted, if you can, or it will be deleted for good.

I hope it will help you!


Original Link: https://dev.to/mxglt/what-does-the-error-cannot-delete-pods-with-local-storage-mean--4phe

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To