Learn KOP - Provision EKS Cluster with Cluster Auto Scaler - Rafay Product Documentation

Part 3: Provision

What Will You Do

In this part of the self-paced exercise, you will provision an Amazon EKS cluster based on a declarative cluster specification


Step 1: Cluster Spec

The "autoscaler-eks-cluster.yaml" file contains the declarative specification for our Amazon EKS Cluster.

Cluster Details

The following items may need to be updated/customized if you made changes to these or used alternate names.

apiVersion: infra.k8smgmt.io/v3
kind: Cluster
metadata:
  name: autoscaler-cluster
  project: defaultproject
spec:
  blueprintConfig:
    name: autoscaler-blueprint
    version: v1
  cloudCredentials: aws-cloud-credential
  config:
    addons:
    - name: kube-proxy
      version: latest
    - name: vpc-cni
      version: latest
    - name: coredns
      version: latest
    iam:
      withOIDC: true
    managedNodeGroups:
    - amiFamily: AmazonLinux2
      iam:
        withAddonPolicies:
          autoScaler: true
      desiredCapacity: 2
      instanceType: t3.large
      maxSize: 2
      minSize: 1
      name: ng-1
    metadata:
      name: autoscaler-cluster
      region: us-west-2
      tags:
        email: user@rafay.co
        env: qa
      version: latest
    network:
      cni:
        name: aws-cni
    vpc:
      autoAllocateIPv6: false
      clusterEndpoints:
        privateAccess: true
        publicAccess: false
      cidr: 192.168.0.0/16
  type: aws-eks

Step 2: Provision Cluster

rctl apply -f autoscaler-eks-cluster.yaml

If there are no errors, you will be presented with a "Task ID" that you can use to check progress/status. Note that this step requires creation of infrastructure in your AWS account and can take ~20-30 minutes to complete.

{
  "taskset_id": "emplg72",
  "operations": [\
    {\
      "operation": "NodegroupCreation",\
      "resource_name": "ng-1",\
      "status": "PROVISION_TASK_STATUS_PENDING"\
    },\
    {\
      "operation": "ClusterCreation",\
      "resource_name": "autoscaler-cluster",\
      "status": "PROVISION_TASK_STATUS_PENDING"\
    }\
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}

Step 3: Verify Cluster

Once provisioning is complete, you should see the cluster in the web console

kubectl get nodes

You should see something like the following

NAME                                           STATUS   ROLES    AGE   VERSION
ip-192-168-24-14.us-west-1.compute.internal    Ready    <none>   11m   v1.21.5-eks-bc4871b
ip-192-168-90-123.us-west-1.compute.internal   Ready    <none>   11m   v1.21.5-eks-bc4871b

Step 4: Verify Cluster Autoscaler

Now, let us verify the Cluster Autoscaler resources are operational on the EKS cluster

kubectl get pod -n autoscaler

You should see something like the following

NAME                                                       READY   STATUS    RESTARTS   AGE
autoscaler-addon-aws-cluster-autoscaler-54bcf79cdf-t5zcl   1/1     Running   0          8m

Recap

Congratulations! At this point, you have successfully configured and provisioned an Amazon EKS cluster with Cluster Autoscaler in your AWS account using the RCTL CLI.