Use NebulaGraph Operator to manage specific clusters¶
NebulaGraph Operator supports the management of multiple NebulaGraph clusters. By default, NebulaGraph Operator manages all NebulaGraph clusters. However, you can specify the clusters managed by NebulaGraph Operator. This topic describes how to specify the clusters managed by NebulaGraph Operator.
Application scenarios¶
- Gray release of NebulaGraph Operator: You want to run the new Nebula Operator version on a part of the clusters first to test and verify its performance before fully releasing it.
- Manage specific clusters: You want NebulaGraph Operator to manage only specific NebulaGraph clusters.
Configurations¶
NebulaGraph Operator supports specifying the clusters managed by controller-manager through startup parameters. The supported parameters are as follows:
watchNamespaces
: Specifies the namespace where the NebulaGraph cluster is located. To specify multiple namespaces, separate them with commas (,
). For example,watchNamespaces=default,nebula
. If this parameter is not specified, NebulaGraph Operator manages all NebulaGraph clusters in all namespaces.
nebulaObjectSelector
: Allows you to set specific labels and values to select the NebulaGraph clusters to be managed. It supports three label operation symbols:=
,==
, and!=
. Both=
and==
mean that the label's value is equal to the specified value, while!=
means the tag's value is not equal to the specified value. Multiple labels are separated by commas (,
), and the comma needs to be escaped with\\
. For example,nebulaObjectSelector=key1=value1\\,key2=value2
, which selects only the NebulaGraph clusters with labelskey1=value1
andkey2=value2
. If this parameter is not specified, NebulaGraph Operator manages all NebulaGraph clusters.
Examples¶
Specify the managed clusters by namespace¶
Run the following command to make NebulaGraph Operator manage only the NebulaGraph clusters in the default
and nebula
namespaces. Ensure that the current Helm Chart version supports this parameter. For more information, see Update the configuration.
helm upgrade nebula-operator nebula-operator/nebula-operator --set watchNamespaces=default,nebula
Specify the managed clusters by label¶
Run the following command to make NebulaGraph Operator manage only the NebulaGraph clusters with the labels key1=value1
and key2=value2
. Ensure that the current Helm Chart version supports this parameter. For more information, see Update the configuration.
helm upgrade nebula-operator nebula-operator/nebula-operator --set nebulaObjectSelector=key1=value1\\,key2=value2
FAQ¶
How to set labels for NebulaGraph clusters?¶
Run the following command to set a label for the NebulaGraph cluster:
kubectl label nc <cluster_name> -n <namespace> <key>=<value>
For example, set the label env=test
for the NebulaGraph cluster named nebula
in the nebulaspace
namespace:
kubectl label nc nebula -n nebulaspace env=test
How to view the labels of NebulaGraph clusters?¶
Run the following command to view the labels of NebulaGraph clusters:
kubectl get nc <cluster_name> -n <namespace> --show-labels
For example, view the labels of the NebulaGraph cluster named nebula
in the nebulaspace
namespace:
kubectl get nc nebula -n nebulaspace --show-labels
How to delete the labels of NebulaGraph clusters?¶
Run the following command to delete the label of NebulaGraph clusters:
kubectl label nc <cluster_name> -n <namespace> <key>-
For example, delete the label env=test
of the NebulaGraph cluster named nebula
in the nebulaspace
namespace:
kubectl label nc nebula -n nebulaspace env-
How to view the namespace where the NebulaGraph cluster is located?¶
Run the following command to list all namespaces where the NebulaGraph clusters are located:
kubectl get nc --all-namespaces