Skip to content

Part 2: 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 using the default blueprint


Step 1: Cluster Spec

  • Open Terminal (on macOS/Linux) or Command Prompt (Windows) and navigate to the folder where you forked the Git repository
  • Navigate to the folder "/getstarted/karpenter/cluster"

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

Cluster Details

In the cluster spec file, we define a tag with the cluster name that will automatically be applied to the AWS cluster resources during cluster creation. This tag will be used by the Karpenter provisioner to identify associated resources.

'cluster-name': 'karpenter-cluster'

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

  • name: "karpenter-cluster"
  • project: "defaultproject"
  • cloudprovider: "aws-cloud-credential"
  • name: "karpenter-cluster"
  • region: "us-west-2"
  • cluster-name: "karpenter-cluster"
  • name: "karpenter"
  • namespace: "karpenter"
kind: Cluster
metadata:
  name: karpenter-cluster
  project: defaultproject
spec:
  blueprint: default
  blueprintversion:
  cloudprovider: aws-cloud-credential
  cniprovider: aws-cni
  type: eks
---
apiVersion: rafay.io/v1alpha5
kind: ClusterConfig
metadata:
  name: karpenter-cluster
  region: us-west-2
  tags:
   'owner': 'tf'
   'cluster-name': 'karpenter-cluster'
  version: "1.21"
iam:
  withOIDC: true
  serviceAccounts:
    - metadata:
        name: karpenter
        namespace: karpenter
      attachPolicy:
        Version: "2012-10-17"
        Statement:
          - Effect: Allow
            Resource: "*"
            Action:
              # Write Operations
              - "ec2:CreateLaunchTemplate"
              - "ec2:CreateFleet"
              - "ec2:RunInstances"
              - "ec2:CreateTags"
              - "iam:PassRole"
              - "ec2:TerminateInstances"
              # Read Operations
              - "ec2:DescribeLaunchTemplates"
              - "ec2:DescribeInstances"
              - "ec2:DescribeSecurityGroups"
              - "ec2:DescribeSubnets"
              - "ec2:DescribeInstanceTypes"
              - "ec2:DescribeInstanceTypeOfferings"
              - "ec2:DescribeAvailabilityZones"
              - "ssm:GetParameter"
managedNodeGroups:
  - name: ng-1
    instanceType: t3.large
    desiredCapacity: 2
    maxSize: 4
    minSize: 1
    ssh:
      enableSsm: true
    iam:
     withAddonPolicies:
      albIngress: true
      efs: true

Step 2: Provision Cluster

  • Type the command below to provision the EKS cluster
rctl apply -f 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.

Cluster: karpenter-cluster
{
  "taskset_id": "lk5x3d2",
  "operations": [
    {
      "operation": "NodegroupCreation",
      "resource_name": "ng-1",
      "status": "PROVISION_TASK_STATUS_PENDING"
    },
    {
      "operation": "ClusterCreation",
      "resource_name": "karpenter-cluster",
      "status": "PROVISION_TASK_STATUS_PENDING"
    }
  ],
  "comments": "The status of the operations can be fetched using taskset_id",
  "status": "PROVISION_TASKSET_STATUS_PENDING"
}
  • Navigate to the "defaultproject" project in your Org
  • Click on Infrastructure -> Clusters. You should see something like the following

Provisioning in Process

  • Click on the cluster name to monitor progress

Provisioning in Process


Step 3: Verify Cluster

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

Provisioned Cluster

  • Click on the kubectl link and type the following command
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

Recap

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