# Part 2: Scale

## What Will You Do 
In this part, you will:

- Scale the number of nodes in the cluster

* * *

## Step 1: Scale Nodes 
In this step, we will scale the number of nodes within the cluster. You can scale the number of nodes up or down, depending on your needs. In this example, we will scale the number of nodes up to 2.

- Navigate to the previously created project in your Org
- Select Infrastructure -> Clusters
- Click on the cluster name of the previously created cluster
- Click the "Nodes" tab
- Click "Add Node"
- Follow the "Node Installation Instructions" on the screen. These instructions will require you to have a shell into the new node. You will need to copy the commands in the installation instructions and execute them on the node. The node will then be configured and presented in the provisioning window.
- Click "Close"

After a few minutes, you will see the new node as discovered and approved

- Click "Provision"
- Click "Yes" to confirm provisioning the node

After a few minutes, from the web console, we can see that the scale operation has completed and the number of "Ready" nodes is 2.

* * *

Download the cluster config from the existing cluster

- Go to Infrastructure -> Clusters. Click on the settings icon of the cluster and select "Download Cluster Config"
- Add the below node section into the config file. Be sure to update the node specific information.

```yaml
- arch: amd64
  hostname: instance-20221129-15188
  operatingSystem: Ubuntu20.04
  privateip: 172.31.61.188
  roles:
    - Storage
    - Worker
  ssh:
    ipAddress: 152.70.157.140
    port: "22"
    privateKeyPath: mks-get-started2.pem
    username: ubuntu
```

The updated YAML file will look like this:

```yaml
apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  labels:
    check1: value1
    check2: value2
  name: mks-get-started
  project: mks
spec:
  blueprint:
    name: default
    version: 1.20.0
  config:
    autoApproveNodes: true
    dedicatedMastersEnabled: false
    highAvailability: false
    kubernetesVersion: v1.24.6
    location: sanjose-us
    network:
      cni:
        name: Calico
        version: 3.19.1
      podSubnet: 10.244.0.0/16
      serviceSubnet: 10.96.0.0/12
    nodes:
      - arch: amd64
        hostname: instance-20221129-1516
        operatingSystem: Ubuntu20.04
        privateip: 172.31.61.40
        roles:
          - Master
          - Worker
          - Storage
        ssh:
          ipAddress: 129.146.141.203
          port: "22"
          privateKeyPath: mks-get-started1.pem
          username: ubuntu
      - arch: amd64
        hostname: instance-20221129-15188
        operatingSystem: Ubuntu20.04
        privateip: 172.31.61.188
        roles:
          - Storage
          - Worker
        ssh:
          ipAddress: 152.70.157.140
          port: "22"
          privateKeyPath: mks-get-started2.pem
          username: ubuntu
  type: mks
```

- Execute the following command to scale the number of nodes within the cluster. Note, update the file name in the below command with the name of your updated specification file.

```bash
./rctl apply -f mks-get-started-config.yaml
```

You will see output similar to the following

```json
{
  "taskset_id": "d27rwvk",
  "operations": [
    {
      "operation": "NodeAddition",
      "resource_name": "instance-20221129-15188",
      "status": "PROVISION_TASK_STATUS_PENDING"
    }
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}
```

From the web console, we can see that the node has been discovered, approved and will automatically be provisioned.

- Navigate to the previously created project in your Org
- Select Infrastructure -> Clusters
- Click on the cluster name of the previously created cluster
- Click the "Nodes" tab to see the additional node

After a few minutes, from the web console, we can see that the scale operation has completed and the number of "Ready" nodes is 2.

* * *

## Recap 
Congratulations! At this point, you have successfully scaled the number of nodes in an MKS cluster

* * *
