...on your own

STOP Please note: this EKS and Karpenter workshop version is now deprecated since the launch of Karpenter v1beta, and has been updated to a new home on AWS Workshop Studio here: Karpenter: Amazon EKS Best Practice and Cloud Cost Optimization.

This workshop remains here for reference to those who have used this workshop before, or those who want to reference this workshop for running Karpenter on version v1alpha5.

Only complete this section if you are running the workshop on your own. If you are at an AWS hosted event (such as re:Invent, Kubecon, Immersion Day, etc), go to Start the workshop at an AWS event.

Running the workshop on your own

Creating an account to run the workshop

Your account must have the ability to create new IAM roles and scope other IAM permissions.

  1. If you don’t already have an AWS account with Administrator access: create one now by clicking here

  2. Once you have an AWS account, ensure you are following the remaining workshop steps as an IAM user with administrator access to the AWS account: Create a new IAM user to use for the workshop

  3. Enter the user details: Create User

  4. Attach the AdministratorAccess IAM Policy: Attach Policy

  5. Click to create the new user: Confirm User

  6. Take note of the login URL and save: Login URL

Deploying CloudFormation

In the interest of time and to focus just on karpenter, we will install everything required to run this Karpenter workshop using cloudformation.

  1. Download locally this cloudformation stack into a file (eks-spot-workshop-quickstarter-cnf.yml).

  2. Go into the CloudFormation console and select the creation of a new stack. Select Template is ready, and then Upload a template file, then select the file that you downloaded to your computer and click on Next

  3. Fill in the Stack Name using ‘karpenter-workshop’, Leave all the settings in the parameters section with the default prarameters and click Next

  4. In the Configure Stack options just scroll to the bottom of the page and click Next

  5. Finally in the Review karpenter-workshop go to the bottom of the page and tick the Capabilities section I acknowledge that AWS CloudFormation might create IAM resources. then click Create stack

The deployment of this stack may take up to 20minutes. You should wait until all the resources in the cloudformation stack have been completed before you start the rest of the workshop. The template deploys resourcess such as (a) An AWS Cloud9 workspace with all the dependencies and IAM privileges to run the workshop (b) An EKS Cluster with the name eksworkshop-eksctl and (c) a EKS managed node group with 2 on-demand instances.

Checking the completion of the stack deployment

One way to check your stack has been fully deployed is to check that all the cloudformation dependencies are green and succedded in the cloudformation dashboard; This should look similar to the state below.

cnf_output

Getting access to Cloud9

In this workshop, you’ll need to reference the resources created by the CloudFormation stack.

  1. On the AWS CloudFormation console, select the stack name that starts with mod- in the list.

  2. In the stack details pane, click the Outputs tab.

cnf_output

It is recommended that you keep this tab / window open so you can easily refer to the outputs and resources throughout the workshop.

you will notice additional Cloudformation stacks were also deployed which is the result of the stack that starts with mod-. One to deploy the Cloud9 Workspace and two other to create the EKS cluster and managed nodegroup.

Launch your Cloud9 workspace

  • Click on the url against Cloud9IDE from the outputs

{{% notice info %}} Please note: this EKS and Karpenter workshop version is now deprecated since the launch of Karpenter v1beta, and has been updated to a new home on AWS Workshop Studio here: Karpenter: Amazon EKS Best Practice and Cloud Cost Optimization.

This workshop remains here for reference to those who have used this workshop before, or those who want to reference this workshop for running Karpenter on version v1alpha5. {{% /notice %}}

  • When it comes up, customize the environment by closing the welcome tab and lower work area, and opening a new terminal tab in the main work area: c9before

  • Your workspace should now look like this: c9after

  • If you like this theme, you can choose it yourself by selecting View / Themes / Solarized / Solarized Dark in the Cloud9 workspace menu.

{{% notice info %}} Please note: this EKS and Karpenter workshop version is now deprecated since the launch of Karpenter v1beta, and has been updated to a new home on AWS Workshop Studio here: Karpenter: Amazon EKS Best Practice and Cloud Cost Optimization.

This workshop remains here for reference to those who have used this workshop before, or those who want to reference this workshop for running Karpenter on version v1alpha5. {{% /notice %}}

Note: Cloud9 normally manages IAM credentials dynamically. This isn’t currently compatible with the EKS IAM authentication, so we will disable it and rely on the IAM role instead. To do so, run the following commands in the Cloud9 workspace:

aws cloud9 update-environment --environment-id ${C9_PID} --managed-credentials-action DISABLE
rm -vf ${HOME}/.aws/credentials

Before we use Karpenter, there are a few things that we will need to prepare in our environment for it to work as expected.

Create the Amazon EC2 Spot Linked Role

To finish the set-up we need to create the spot EC2 Spot Linked role.

This step is only necessary if this is the first time you’re using EC2 Spot in this account. If the role has already been successfully created, you will see: An error occurred (InvalidInput) when calling the CreateServiceLinkedRole operation: Service role name AWSServiceRoleForEC2Spot has been taken in this account, please try a different suffix. . Just ignore the error and proceed with the rest of the workshop.

In your Cloud9 terminal workspace, run the following command:

aws iam create-service-linked-role --aws-service-name spot.amazonaws.com

You are now ready to Test the Cluster