跳转至

配置删除保护

NebulaGraph Operator 支持删除保护,以防止NebulaGraph集群被意外删除。本文介绍如何为NebulaGraph集群配置删除保护。

前提条件

添加注解以开启删除保护

添加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集群关闭了删除保护。


最后更新: April 26, 2024