Skip to content

Configure deletion protection

NebulaGraph Operator supports deletion protection to prevent NebulaGraph clusters from being deleted by accident. This topic describes how to configure deletion protection for a NebulaGraph cluster.

Prerequisites

Add an annotation to enable deletion protection

Add the delete-protection annotation to the cluster.

kubectl annotate nc nebula -n nebula-test nebula-graph.io/delete-protection=true
The preceding command enables deletion protection for the nebula cluster in the nebula-test namespace.

Verify deletion protection

To verify that deletion protection is enabled, run the following command:

kubectl delete nc nebula -n nebula-test

The preceding command attempts to delete the nebula cluster in the nebula-test namespace.

Output:

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

Remove the annotation to disable deletion protection

Remove the delete-protection annotation from the cluster as follows:

kubectl annotate nc nebula -n nebula-test nebula-graph.io/delete-protection-

The preceding command disables deletion protection for the nebula cluster in the nebula-test namespace.


Last update: March 6, 2024