Skip to content

Part 3: Node Group

In this part, you will add a new node group to your EKS cluster increasing its capacity.


Assumptions

This part assumes that you have completed Parts 1 and 2 of this series and have a successfully provisioned and healthy EKS cluster.


Add Node Group

In this step, we will scale the cluster by adding a new "spot instance" based node group to the cluster.

Note

You can either use the web console OR use a declarative cluster specification with the RCTL CLI to manage your EKS cluster's lifecycle.

  • In your project, navigate to Infrastructure -> Clusters
  • Click on the "cluster name" and then the "node groups" tab.
  • Click on "Add Node Group"

Add Spot Node Group

  • In the node group configuration, specify the following
  • Provide a name such as "spot-ng"
  • Select "Use Spot Instances"
  • Select "custom" for Instance type and enter "t3.large"
  • Enter min nodes as 2 and max nodes as 4
  • Enter "$0.03" for "Spot Max Price"
  • Enter "50" for onDemandPercentageAboveBaseCapacity

Configure Node Group

  • Click on "Provision.

This will create the new node group and associated infrastructure and add it to your EKS cluster. The entire process can take a few minutes to complete.

Download the cluster specification for the existing cluster

  • Go to Infrastructure -> Clusters.
  • Click on the settings icon of the cluster and select "Download Cluster Config"
  • Update the downloaded specification file with the YAML for the additional node group.
  • Add the following node group configuration code to the previously applied cluster specification file
nodeGroups:
- name: spot-ng-1
  minSize: 2
  maxSize: 4
  instancesDistribution:
    maxPrice: 0.03
    instanceTypes: ["t3.large"]
    onDemandBaseCapacity: 0
    onDemandPercentageAboveBaseCapacity: 50
    spotInstancePools: 2

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

kind: Cluster
metadata:
  name: demo-eks-testing
  project: defaultproject
spec:
  type: eks
  cloudprovider: demo
  blueprint: default
---
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
  name: demo-eks-testing
  region: us-west-2

managedNodeGroups:
  - name: ng-1
    instanceType: t3.large
    desiredCapacity: 2

nodeGroups:
- name: spot-ngs
  minSize: 2
  maxSize: 4
  instancesDistribution:
    maxPrice: 0.03
    instanceTypes: ["t3.large"]
    onDemandBaseCapacity: 0
    onDemandPercentageAboveBaseCapacity: 50
    spotInstancePools: 2
  • Execute the following command to create the spot instance node group
./rctl apply -f eks-cluster-basics.yaml

Expected Output

Cluster: demo-eks-testing
{
    "taskset_id": "g29j3m0",
    "operations": [
    {
      "operation": "NodegroupCreation",
      "resource_name": "spot-ng",
      "status": "PROVISION_TASK_STATUS_PENDING"
    }
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}

Verify Node Group

Once the new, spot based node group has been successfully added to the EKS cluster, you should be able to view the "new node group's details"

View New Node Group

Users can also use the Zero Trust Kubectl shell to view details about the new node by using the following command.

kubectl get no

ZTKA New Nodes

As you can see from this example, Kubectl is reporting "two new nodes" with a relatively recent "age". These are our Spot Instance based nodes from the node group.


Remove Node Group

In this step, we will remove the spot instance based node group we added recently. The process to remove a node group is very similar to the process of adding a node group.

Note

You can either use the web console OR use a declarative cluster specification with the RCTL CLI to manage your EKS cluster's lifecycle.

  • In your project, navigate to Infrastructure -> Clusters
  • Click on the "cluster name" and then the "node groups" tab.
  • Click on the gear icon next to the spot node group
  • Click on "Delete Node Group" and confirm it

Delete Spot Node Group

This will "drain" the nodes in this node group and remove them from the EKS cluster. The entire process can take 5-10 minutes to complete.

Download the cluster specification for the existing cluster

  • Go to Infrastructure -> Clusters.
  • Click on the settings icon of the cluster and select "Download Cluster Config"
  • Update the downloaded specification file with the YAML for the additional node group.
  • Remove the YAML for the spot node group

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

kind: Cluster
metadata:
  name: demo-eks-testing
  project: defaultproject
spec:
  type: eks
  cloudprovider: demo
  blueprint: default
---
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
  name: demo-eks-testing
  region: us-west-2

managedNodeGroups:
  - name: ng-1
    instanceType: t3.large
    desiredCapacity: 2
  • Execute the following command to remove the spot instance node group
./rctl apply -f eks-cluster-basics.yaml

Verify Deletion

Once the new, spot based node group has been successfully deleted from the EKS cluster, you should be able to confirm this on the web console.

View after Deletion


Recap

Congratulations!

You have successfully successfully added a "spot instance" based node group to your EKS cluster to take advantage of discounted compute resources. As a final step, you also successfully removed the "spot" based node group from your EKS cluster.