简体   繁体   中英

Correct teardown sequence for Kubernetes infrastructure components

In order to deploy my k8s cluster I kubectl apply -f folder-of-yamls/

And it seems that the order of execution is important. One approach I've seen is to prefix 001-namespace.yaml 002-secrets.yaml etc. to create an ordering.

To tear down, if I kubectl delete -f folder-of-yamls/ , can I simply reverse the order or must I manually create a sequence?

Order of deletion shouldn't matter to much, as mentioned by David Maze in comments, kubectl delete -f folder/ will clean up everything correctly, however there might be some issues when you delete objects that are dependent from other. For example PVC should be deleted before PV (PV will take forever to be deleted) but kubernetes should take care of that if everything is present in directory you are deleting yamls from.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM