Learn KOP - Scale GKE Cluster - Rafay Product Documentation

Part 2: Scale

What Will You Do

In this part, you will:


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 down to 1.

You will see the scale operation displayed

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


Step 2: Add Node Pool

In this step, we will add a node pool to the cluster.

From the web console, we can see that the new node pool is being created. This could take up to 15 minutes to complete.

Monitor the web console until the node pool has been created


Step 3: Remove Node Pool

In this step, we will remove the node pool from the cluster.

From the web console, we can see that the new node pool is being removed

Monitor the web console until the node pool has been removed. You will only see one node pool remaining.


Step 1: Scale Nodes

Download the cluster config from the existing cluster

size: 1

The updated YAML file will look like this:

apiVersion: infra.k8smgmt.io/v2
kind: Cluster
metadata:
    labels:
        rafay.dev/clusterName: gke-get-started-cluster
        rafay.dev/clusterType: gke
    name: gke-get-started-cluster
    project: gke
spec:
    blueprint:
        name: default-gke
        version: latest
    cloudCredentials: GCP-CC
    config:
        controlPlaneVersion: "1.22"
        location:
            defaultNodeLocations:
                - us-west1-c
            type: zonal
            zone: us-west1-c
        name: gke-get-started-cluster
        network:
            enableVPCNativeTraffic: true
            maxPodsPerNode: 110
            name: default
            networkAccess:
                privacy: public
            nodeSubnetName: default
        nodePools:
            - machineConfig:
                bootDiskSize: 100
                bootDiskType: pd-standard
                imageType: COS_CONTAINERD
                machineType: e2-standard-4
              name: default-nodepool
              nodeVersion: "1.22"
              size: 1
        project: demos-249423
    type: Gke
./rctl apply -f gke-get-started-cluster-config.yaml

From the web console, we can see that the scale operation is in progress.

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


Step 2: Add Node Pool

In this step, we will add a node pool to the cluster. We will modify the specification file that was applied in step 1.

nodePools:
    - machineConfig:
        bootDiskSize: 100
        bootDiskType: pd-standard
        imageType: COS_CONTAINERD
        machineType: e2-standard-4
      name: pool2
      nodeVersion: "1.22"
      size: 1

The fully updated cluster specification file including the newly added spot instance node pool code will look like this:

./rctl apply -f gke-cluster-basic.yaml

From the web console, we can see that the new node pool is being created. This could take up to 15 minutes to complete.

Monitor the web console until the node pool has been created


Step 3: Remove Node Pool

In this step, we will remove the node pool from the cluster. We will modify the specification file that was applied in step 2. We will simply remove the code section that was added in step 2 to remove the node pool.

  - machineConfig:
      bootDiskSize: 100
      bootDiskType: pd-standard
      imageType: COS_CONTAINERD
      machineType: e2-standard-4
    name: pool2
    nodeVersion: "1.22"
    size: 1

The updated cluster specification file with the removed node pool code will look like this:

./rctl apply -f gke-cluster-basic.yaml

From the web console, we can see that the new node pool is being removed

Monitor the web console until the node pool has been removed. You will only see one node pool remaining.


Recap

Congratulations! At this point, you have