Deleting ReplicaSets 删除副本集
When a ReplicaSet is no longer required it can be deleted using the kubectl delete command. By default, this also deletes the Pods that are managed by the ReplicaSet:
当不再需要 ReplicaSet 时,可以使用 kubectl delete 命令将其删除。默认情况下,这也会删除 ReplicaSet 所管理的 Pod:
kubectl delete rs kuard
Running the kubectl get pods command shows that all the kuard Pods created by the kuard ReplicaSet have also been deleted:
运行 kubectl get pods 命令显示,kuard ReplicaSet 创建的所有 kuard Pod 也已删除:
kubectl get pods
If you don’t want to delete the Pods that are being managed by the ReplicaSet, you can set the --cascade flag to false to ensure only the ReplicaSet object is deleted and not the Pods:
如果不想删除由 ReplicaSet 管理的 Pod,可以将 --cascade 标志设置为 false,以确保只删除 ReplicaSet 对象,而不删除 Pod:
kubectl delete rs kuard --cascade=false