配置删除保护
NebulaGraph Operator 支持删除保护,以防止悦数图数据库集群被意外删除。本文介绍如何为悦数图数据库集群配置删除保护。
前提条件
- 悦数图数据库集群已创建。更多信息,请参见创建悦数图数据库集群。
- 悦数图数据库集群已启用准入控制。更多信息,请参见开启准入控制。
添加注解以开启删除保护
添加delete-protection注解到集群。
kubectl annotate nc nebula -n nebula-test nebula-graph.io/delete-protection=true
以上命令为nebula-test命名空间中的nebula集群启用了删除保护。
验证删除保护
To verify that deletion protection is enabled, run the following command:
运行以下命令验证删除保护是否已启用:
kubectl delete nc nebula -n nebula-test
以上命令尝试删除nebula-test命名空间中的nebula集群。
返回信息:
Error from server: admission webhook "nebulaclustervalidating.nebula-graph.io" denied the request: metadata.annotations[nebula-graph.io/delete-protection]: Forbidden: protected cluster cannot be deleted
删除注解以关闭删除保护
从集群中删除delete-protection注解:
kubectl annotate nc nebula -n nebula-test nebula-graph.io/delete-protection-
以上命令为nebula-test命名空间中的nebula集群关闭了删除保护。