Cluster Operations

This page describes the steps to perform the following operations using the TigerGraph Kubernetes Operator.

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.

Kubernetes Operator support is currently a Preview Feature. Preview Features give users an early look at future production-level features. Preview Features should not be used for production deployments.

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.

Run kubectl get storageclass to show the names of the available storage classes.

$ kubectl get storageclass

gcp-pd-ssd     Delete          WaitForFirstConsumer   false                  35d
premium-rwo   Delete          WaitForFirstConsumer   true                   232d
standard (default)    Delete          Immediate              true                   232d
standard-rwo   Delete          WaitForFirstConsumer   true                   232d

The default storage class is standard.

If you create a cluster in a specific namespace, the namespace must already exist. The command does not create a namespace for you.

You can specify pod CPU, memory, TigerGraph version, and other parameters through command-line options.

You must also provide your license key with the --license command. Contact TigerGraph support for help finding your license key. A free license, valid for 14 days, is available through this link: A free license is available through this link:

Starting with Operator version 0.0.4, you need to provide your own SSH key for security. See Secrets in Kubernetes for more information. In this example, it is named ssh-key-secret.

# Create a new private key
echo -e 'y\n' | ssh-keygen -b 4096 -t rsa -f $HOME/.ssh/tigergraph_rsa -q -N ''

# Create a Kubernetes secret with above SSH key files
kubectl create secret generic ssh-key-secret --from-file=private-ssh-key=$HOME/.ssh/tigergraph_rsa --from-file=public-ssh-key=$HOME/.ssh/ --namespace YOUR_NAME_SPACE
Example cluster creation command
kubectl tg create --cluster-name <your cluster name> --size 3 --ha 2 --version 3.9.0 --private-key-secret ssh-key-secret \
 --storage-class standard --storage-size 10G --cpu 3000m --memory 6Gi --namespace ${YOUR_NAMESPACE} --license <your TigerGraph license>

Run kubectl tg help to view all options available and their default values, which will be used if left unspecified. Some of the most common additional options are explained here.

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 into 3 partitions.

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>

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 version and 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>

You can also check the version with version.

$ kubectl tg version
Version: 0.0.4
Default version of TigerGraph cluster: 3.9.0

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>

Shrink or expand a cluster

Run the following commands to change the size 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 update --cluster-name <cluster_name> --size <size> --ha <ha_factor> --namespace <namespace_name>

The --ha flag to change the High Availability factor is optional.

After shrinking a cluster, delete the PVC of the pods which were deleted. Otherwise, executing the expand command in the future will cause an error for the remaining data on the PVC.

Running kubectl tg update automatically creates a backup of the cluster CR before the update. If the update fails, delete the failed cluster, then create it again from the backup file.

kubectl apply -f <path_to_cluster_backup> --namespace <namespace_name>

Remember that an expansion operation creates new pods, so in the case of a failed expansion, the newly created pods should be manually removed.

For example, if expanding from a cluster size of 5 to 6 results in a failed expansion, delete cluster number 5 (cluster numbering begins with 0).

Run kubectl get pvc -l app=<app_name> --namespace <namespace_name> to list all PVCs and double-check their age. The newest PVC is the one to delete.

Update cluster resources

The update command can also be used to change the resources available to the cluster.

kubectl tg update --cluster-name test001 --cpu 4 --memory 8Gi  --namespace tigergraph

The values after the --cpu and --memory flags must follow the format specified in the official Kubernetes document for Resource Management for Pods and Containers.

After updating resources, wait for the cluster status to change to Normal or True. Check this with the following command: kubectl tg status --cluster-name ${YOUR_CLUSTER_NAME} -n ${YOUR_NAME_SPACE}

Upgrade cluster version

Upgrades are only supported from a lower version to a higher version. Assume the current cluster version is 3.8.0. You can upgrade the cluster to 3.9.0 with this command:

kubectl tg update --cluster-name <cluster_name> --version 3.9.0  --namespace <namespace_name>

After updating the version of the cluster, wait for the cluster status to change to Normal. Check this with the following command: kubectl tg status --cluster-name ${YOUR_CLUSTER_NAME} -n ${YOUR_NAME_SPACE}