Cluster Operations
This page describes the steps to perform the following operations using the TigerGraph Kubernetes Operator.
Kubernetes Operator is a Preview Feature.
Preview Features give users an early look at future production-level features. Preview Features should not be used for production deployments. |
In Kubernetes, you provision resources such as TigerGraph clusters by creating a Deployment. Depending on the context, this document may refer to creating a cluster by creating a Deployment.
Create TigerGraph clusters
To create a TigerGraph cluster, run the following command:
$ kubectl tg create --cluster-name <cluster_name> --storage-class <storage_class> --namespace <namespace_name>
Each cluster is provisioned with persistent volumes for each node by default. When you create a cluster with persistent volumes, you must specify a storage class.
If you create a cluster in a specific namespace, the namespace must already exist. The command does not create a namespace for you.
If you have cloned TigerGraph images for a self-hosted registry, specify the registry with the --docker-registry
option:
$ kubectl tg create --cluster-name <cluster_name> --namespace <namespace_name> --docker-registry <your_registry>
If your registry is private, you also need to provide a Secret that allows you to access to the private registry. Make sure the Secret exists in the same namespace as the one where you are creating the cluster.
You can specify pod CPU, memory, and TigerGraph version etc. through command-line options.
Run kubectl tg help
to view all options available.
If you do not specify the options, the command uses the default values for each of the options.
You can view the default values for each options in the help text as well.
The --ha flag specifies the replication factor (HA factor) of the cluster, which is the total number of instances of your data.
If you create a 6-node cluster with the --ha 2 flag, your cluster has two instances of data that are divided int 3 partitions.
|
List TigerGraph clusters
Run the following command to list all running TigerGraph clusters in all namespaces as well as their size:
$ kubectl tg list --namespace all
If you want to limit the scope to a specific namespace, change all
to the namespace you want to list clusters for.
Check cluster status
Run the following command to check the status of a cluster.
Replace <cluster_name>
with the name of the cluster, and <namespace_name>
with the namespace where the cluster is provisioned:
$ kubectl tg status --cluster-name <cluster_name> --namespace <namespace_name>
Delete TigerGraph clusters
Run the following command to delete a cluster.
Replace <cluster_name>
with the name of the cluster, and <namespace_name>
with the namespace where the cluster is provisioned:
$ kubectl tg delete --cluster-name <cluster_name> --namespace <namespace_name>
To protect your data, deleting a cluster does not delete the Persistent Volume Claims (PVC) provisioned when you create the cluster.
To delete the PVCs created with a cluster, run the following command:
$ kubectl delete pvc -l app=<cluster_name> -n <namespace_name>