--- title: "Prep Lab 2.1: Provision a Kubernetes Cluster Using The AWS EKS Quick Start" weight: 21 chapter: true draft: false description: "Provision a value-added EKS spot cluster by using the official AWS Quick Start." --- # Prep Lab 2.1: Provision a Kubernetes Cluster Using The AWS EKS Quick Start > **Keyboard Time**: 5 mins, **Automation Wait Time**: 60 mins > > **Scenarios:** Instructor-Led, Self-Paced {{< admonition type=success title="What is an AWS Quick Start?" open=true >}} “Quick Starts are automated reference deployments built by Amazon Web Services (AWS) solutions architects and AWS Partners. Quick Starts help you deploy popular technologies on AWS according to AWS best practices. You can reduce hundreds of manual procedures to just a few steps so that you can build and start using your environment within minutes.” Quote from: [AWS Quick Starts](https://aws.amazon.com/quickstart/?solutions-all.sort-by=item.additionalFields.sortDate&solutions-all.sort-order=desc&awsf.filter-content-type=*all&awsf.filter-tech-category=*all&awsf.filter-industry=*all) Since this Quick Start is for AWS technology and functions as a dependency of many other partner Quick Starts - it reflects AWS internal best practices for EKS deployment and has value over console or eksctl deployment methods. For these labs we take advantage of the single parameter inclusion of the Kubernetes Cluster Autoscaler and spot instances and especially the very valuable EKS Bastion for cluster administration. {{< /admonition >}} {{< admonition type=danger title="Classroom Setup and Labs Assume EKS Quick Start" open=true >}} The exercises, as written, assume that the cluster was prepared with the EKS Quick Start. If you decide to use other methods, you will need to also provision a cluster administration workstation with helm, kubectl, kube configuration and AWS authentication to perform EKS administration commands as needed. Additionally, you will need to plan for Kubernetes node scaling that matches your class size. If you prepare the cluster by another means, be sure to run through all exercises with your cluster before considering it ready for a classroom. Scale testing with a group should also be performed if using alternative cluster node autoscaling. {{< /admonition >}} {{< admonition type=abstract title="Target Outcomes" open=true >}} {{< admonition type=warning title="IMPORTANT: Time Saving Automation" open=true >}} A new CloudFormation template can simplify your setup to one template run rather than three to automate both the EKS Cluster and Runner Fleet creation. You must skip ahead and do the steps in Prep Lab 2.2 for creating 'classgroup' and retrieving the Runner Registration Token from that group. Then running this template results in completion of Prep Lab 2.1 and 2.2. Prep Lab 2.3 will still need to be done. [UltimateGitOpsEKSInfrastructure.cf.yml (Click for QuickLaunch in AWS)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateUrl=https://s3.us-west-2.amazonaws.com/gl-public-templates/UltimateGitOpsEKSInfrastructure.cf.yml) {{< /admonition >}} 1. Create an EKS Cluster that is very cost optimized for training scenarios. 2. Do so very quickly by leveraging AWS official Managed Infrastructure as Code known as “AWS Quick Starts”. 3. **Not a Target**: Learning the detailed ins and outs of deploying and configuring EKS. {{< /admonition >}} {{< admonition type=warning title="IMPORTANT: Time Saving Automation" open=true >}} A new CloudFormation template can simplify your setup to one template run rather than three to automate both the EKS Cluster and Runner Fleet creation. You must skip ahead and do the steps in Prep Lab 2.2 for creating 'classgroup' and retrieving the Runner Registration Token from that group. Then running this template results in completion of Prep Lab 2.1 and 2.2. Prep Lab 2.3 will still need to be done. [UltimateGitOpsEKSInfrastructure.cf.yml (Click for QuickLaunch in AWS)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateUrl=https://s3.us-west-2.amazonaws.com/gl-public-templates/UltimateGitOpsEKSInfrastructure.cf.yml) **This is the preferred way to deploy AWS Event Engine accounts when cohosted by AWS. AWS Event Engine deployments can only be done in us-east-1.** {{< /admonition >}} ## Deploy Official AWS EKS QuickStart with Spot Nodes > **Keyboard Time**: 5 mins, **Automation Wait Time**: 60 mins > > **Scenarios:** Instructor-Led, Self-Paced > > Guides Through: [AWS EKS on the AWS Cloud](https://aws-quickstart.github.io/quickstart-amazon-eks/) {{< admonition type=warning title="IMPORTANT" open=true >}} In order to take advantage of spot support and specifying the Kubernetes version (required by GitLab integration), we must first deploy a small ‘Advanced Configuration’ template from the EKS Quick Start that is then read by the main EKS Quick Start template when deploying. {{< /admonition >}} 1. Login to your target AWS account. 2. The following links will set the parameters in the table for you. You may customize the parameters before submitting the template. **IMPORTANT** Cluster add-on settings for Hashicorp vault and others are not used unless these items are installed during the next template deployment - they can be ignored. - To Deploy to us-east-2 (in case us-east-1 is near account quota limits): [Click this link to deploy the Advanced Configuration Template with the below parameters preconfigured](https://us-east-2.console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/quickcreate?templateUrl=https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-advanced-configuration.template.yaml&stackName=spot-t2-medium-paramset¶m_OnDemandBastionPercentage=0¶m_ConfigSetName=spot-t2-medium-paramset¶m_KubernetesVersion=1.21¶m_NodeInstanceType2=t3.medium¶m_NodeInstanceType3=t3.large¶m_OnDemandPercentage=0) - To Deploy to us-east-1 (required for AWS “Event Engine” provisioned accounts): [Click this link to deploy the Advanced Configuration Template with the below parameters preconfigured](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateUrl=https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-advanced-configuration.template.yaml&stackName=spot-t2-medium-paramset¶m_OnDemandBastionPercentage=0¶m_ConfigSetName=spot-t2-medium-paramset¶m_KubernetesVersion=1.21¶m_NodeInstanceType2=t3.medium¶m_NodeInstanceType3=t3.large¶m_OnDemandPercentage=0) | CF GUI Name         | CF Parameter Name | Value           | Notes | | ------------------------------------------------------------ | ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | Stack name | N/A | spot-t2-medium-paramset | | | Config set name | ConfigSetName | spot-t2-medium-paramset | | | Kubernetes version | KubernetesVersion | 1.21 | GitLab integrated K8s clusters must use specific versions | | Instance type 2 | NodeInstanceType2 | t3.medium | Instance type cannot match what is used for NodeInstanceType
in the EKS Quick Start deployment (next template below) as that value
is used for the first spot type when spot is configured and all NodeInstanceTypes in a spot configuration must be unique from each other. | | Instance type 3 | NodeInstanceType3 | t3.large | Instance type cannot match what is used for NodeInstanceType in the EKS Quick Start deployment (next template below) as that value is used for the first spot type when spot is configured and all NodeInstanceTypes in a spot configuration must be unique from each other. | | Default EKS node group configuration: On-demand percentage | OnDemandPercentage | 0 | | | Bastion configuration: On-demand percentage | OnDemandBastionPercentage | 0 | Sets bastion host to be spot. | **Important**: EKS Advanced Configuration 'Config sets' can be used to configure multiple deployments of the EKS Quick Start. 6. Verify the above values - **including any name substitutions you have elected to make.** 7. At 'the bottom of the page', *Click* **Create stack**. 8. Wait for the deployment to complete successfully. {{< admonition type=warning title="Warning" open=true >}} **IMPORTANT FOR Instructor-Led** - setup 1 EKS node per 5 students. This can be easily adjusted later and these are spot instances. {{< /admonition >}} 9. The following links will set the parameters in the table for you. You may customize the parameters before submitting the template. - To Deploy to us-east-2 (in case us-east-1 is near account quota limits): [Click this link to deploy the Advanced Configuration Template with the below parameters preconfigured](https://us-east-2.console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/quickcreate?templateUrl=https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-entrypoint-new-vpc.template.yaml&stackName=spot2az¶m_AvailabilityZones=us-east-2b,us-east-2c¶m_RemoteAccessCIDR=disabled-onlyssmaccess¶m_ConfigSetName=spot-t2-medium-paramset¶m_NodeInstanceType=t2.medium¶m_EKSClusterName=spot2azuseast2¶m_NumberOfAZs=2¶m_NumberOfNodes=2¶m_MaxNumberOfNodes=3¶m_NodeGroupType=Unmanaged¶m_NodeInstanceFamily=Standard¶m_ClusterAutoScaler=Enabled) - To Deploy to us-east-1 (required for AWS “Event Engine” provisioned accounts): [Click this link to deploy the Advanced Configuration Template with the below parameters preconfigured](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateUrl=https://s3.amazonaws.com/aws-quickstart/quickstart-amazon-eks/templates/amazon-eks-entrypoint-new-vpc.template.yaml&stackName=spot2az¶m_AvailabilityZones=us-east-1b,us-east-1c¶m_RemoteAccessCIDR=disabled-onlyssmaccess¶m_ConfigSetName=spot-t2-medium-paramset¶m_NodeInstanceType=t2.medium¶m_EKSClusterName=spot2azuseast1¶m_NumberOfAZs=2¶m_NumberOfNodes=2¶m_MaxNumberOfNodes=3¶m_NodeGroupType=Unmanaged¶m_NodeInstanceFamily=Standard¶m_ClusterAutoScaler=Enabled) | CF GUI Name | CF Parameter Name | Value | | | ---------------------------------------------------------- | ------------------------- | ------------------------------- | ------------------------------------------------------------ | | Stack name | N/A | spot2az | | | Availability Zones | AvailabilityZones | us-east-2b,us-east-2c (example) | | | Allowed external access CIDR | RemoteAccessCIDR | disabled-onlyssmaccess | | | Config set name | ConfigSetName | spot-t2-medium-v120-paramset | Must match Config set name in above 'Advanced Configuration Template' | | Number of Availability Zones | NumberOfAZs | 2 | | | Amazon EC2 configuration: On-demand percentage | OnDemandBastionPercentage | | **Ignored and overidden by ‘Advanced Configuration Template’** | | EKS cluster name | EKSClusterName | spot2az | | | Kubernetes Version | KubernetesVersion | | **Ignored and overidden by ‘Advanced Configuration Template’** | | Instance type | NodeInstanceType | t2.medium | | | Number of nodes | NumberOfNodes | 2 | | | Maximum number of nodes | MaxNumberOfNodes | 3 | **IMPORTANT Instructor-Led:** Adjust for class size, about 1 node per 5 students. | | Node group type | NodeGroupType | Unmanaged | | | Default EKS node group configuration: On-demand percentage | OnDemandPercentage | | **Ignored and overidden by ‘Advanced Configuration Template’** | | Node instance family | NodeInstanceFamily | Standard | Auto DevOps will not work on ARM clusters | | Cluster Autoscaler | ClusterAutoScaler | Enabled | | 10. Verify the above values - **including any name substitutions you have elected to make.** 11. At 'the bottom of the page' *Check* **I acknowledge that AWS CloudFormation might create IAM resources with custom names.** 12. *Check* **I acknowledge that AWS CloudFormation might require the following capability: CAPABILITY_AUTO_EXPAND** 13. *Click* **Create stack**. {{< admonition type=info title="Prep Lab 2.2 Can Be Done in Parallel" open=true >}} You can complete Prep Lab 2.2 while this CloudFormation is processing, but this CF must complete successfully before doing Prep Lab 2.3. {{< /admonition >}} {{< admonition type=abstract title="Accomplished Outcomes" open=true >}} 1. Create an EKS Cluster that is very cost optimized for training scenarios. 2. Do so very quickly by leveraging AWS official Managed Infrastructure as Code known as “AWS Quick Starts”. {{< /admonition >}}