[英]How to delete a kubernetes cluster using kops without deleting EBS persistent volume that I used for my database?
When I tried to delete a kubernetes cluster running in AWS, it removed all the associated resources like loadbalancers of my application, autoscaling groups, EC2 instances and its EBS volumes as expected.当我尝试删除在 AWS 中运行的 kubernetes 集群时,它按预期删除了所有相关资源,例如我的应用程序的负载均衡器、自动扩展组、EC2 实例及其 EBS 卷。 However, it also removed EBS volume that I used as a persistent volume.
但是,它也删除了我用作持久卷的 EBS 卷。 Luckily, I had a snapshot to create an EBS volume out of it.
幸运的是,我有一个快照可以从中创建一个 EBS 卷。 How to avoid this in future when I want to delete my cluster without disturbing EBS volume that I used for my database?
当我想在不影响用于数据库的 EBS 卷的情况下删除集群时,如何避免这种情况?
I followed the steps below for deleting my cluster.我按照以下步骤删除了我的集群。
Kubectl delete -f my-applicaton.yml
(to terminate all the services&deployments including database pod) Kubectl delete -f my-applicaton.yml
(终止所有服务和部署,包括数据库 pod)DELETE
to RETAIN
DELETE
更改为RETAIN
kubectl delete pvc db-pvc
(deleted persistent volume claim) kubectl delete pvc db-pvc
(已删除持久卷声明)kubectl delete pv db-pv
(deleted persistent volume) kubectl delete pv db-pv
(删除的持久卷)kops delete cluster --name ${NAME} --yes
To prevent kOps from deleting the EBS(Elastic Block Store) volume you need to remove all the tags on the EBS volume.要防止 kOps 删除 EBS(弹性块存储)卷,您需要删除 EBS 卷上的所有标签。 Then you can add this to your PV in your new cluster in order to reuse it:
然后,您可以将其添加到新集群中的 PV 以重用它:
awsElasticBlockStore:
volumeID: <vol-123>
fsType: ext4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.