# Expanding and Shrinking of a Compute Cluster
This section describes the process required to expand or shrink an existing compute cluster (not imported) with the help of automation scripts.
Figure: Cluster Expand/Shrink Flow Diagram
Pre-requisites
Refer to Installer Machine section to set up the required python and ansible environment.
Python module 'requests'.
The hosts to be added or removed from the cluster must be in the available list of HOSTS.
An existing compute cluster.
# Process
Enter the console username and password in the config_secrets.json file. (vault-key is changeme)
> ansible-vault edit config_secrets.json
Here we have 2 input parameters.
- CONSOLE_USERNAME* - ECP console username
- CONSOLE_PASSWORD* - ECP console password
Enter the config details in the user_input.json file
> vi user_input.json
Here we have 5 input parameters
- CONTROLLER_IP - IP address of the primary controller
- CLUSTER_NAME - Name of the existing compute cluster
- EXPAND_OR_SHRINK - Cluster Operation ('expand' or 'shrink')
- HOST_IP's - Host IP's for expansion or shrinking( Host must be present in the list of available hosts)
- HOST_ROLE - Roles of the Hosts ('master' or 'worker')
Run the python script expand_shrink.py
> python expand_shrink.py
# Expanding The Cluster
- Fill the config_secrets.json file. Sample config_secrets.json file shown below.
- Fill the user_input.json file. Sample user_input.json file shown below.
- Initial Cluster Configuration (1 master and 3 worker nodes):
Figure: Initial Cluster Configuration
Execute the expand_shrink.py script
Expanded Cluster (3 master and 5 worker nodes)
Figure: Expanded Cluster Configuration
# Shrinking The Cluster
- Fill the config_secrets.json file. Sample config.secrets.json shown below.
- Fill the user_input.json file. Sample user_input.json file shown below.
- Initial Cluster Configuration (3 master and 5 worker nodes):
Figure: Initial Cluster Configuration
Execute the expand_shrink.py script
Shrinked Cluster (3 master and 3 worker nodes)
Figure: Shrinked Cluster Configuration