Shrink a Cluster - Kubernetes

Like regular TigerGraph clusters, a TigerGraph cluster deployed on Kubernetes can also be shrunk. When you shrink a TigerGraph cluster on Kubernetes, the data across the different nodes are automatically redistributed.

Shrinking a cluster requires several minutes of downtime.

1. Prerequisites

  • A running TigerGraph Deployment in a Kubernetes cluster

  • You have configured kubectl for access to your running Kubernetes cluster.

2. Procedure

The following are the steps to expand a TigerGraph cluster on Kubernetes.

2.1. Identify new cluster replication and partition

Before running any commands to expand a cluster, make sure you have a clear idea of how the new cluster should be distributed. You should have the following information:

  • The new replication factor of the cluster

  • The new partitioning factor of the cluster

  • The new size of the cluster

2.2. Download script

Clone the repository at https://github.com/tigergraph/ecosys.

Change into the k8s directory. There is a script named tg that you need to perform the actions described in this page.

2.3. Shrink cluster

Invoke the tg script with the following arguments to expand the cluster:

$ ./tg <cloud_platform> shrink -s <new_size> --ha <replication_factor> -n <namespace> --prefix <prefix>
  • Replace <cloud_platform> with the cloud platform where your Kubernetes cluster is provisioned. Possible values are: gke, aks, eks.

  • Replace <replication_factor> with the intended replication factor of newly resized cluster.

  • Replace <new_size> with the new size (the number of nodes) of the cluster. This value is required.

  • Replace <namespace> with the namespace where your resources reside. If not provided, the script uses the default namespace default.

  • Replace <prefix> with the Pod name prefix you used when you created the cluster. If you didn’t specify a prefix when creating the cluster, do not specify one here.

For example, to shrink a TigerGraph Deployment in the example namespace of a Google Kubernetes Engine (GKE) Kubernetes cluster to a 4-node cluster, run the following command:

./tg gke shrink -s 4 -n example

2.4. Perform post-shrink cleanup

After cluster shrinking, you’ll be prompted by the script clean up your unused pods and volumes. Run the following command to delete the unused pods and volumes:

$ ./tg <k8s_provider> post-shrink -n <namespace> --prefix <prefix>

This deletes all unused pods and volumes, as well as the data and logs that were stored in them. Make sure any data that is still needed is copied off of the pod before deletion, including backups