Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EKS 1.21 upgrade #163

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d3ff099
Removed i3s, added AWS Instance Selector, Cloud9
jagpk Dec 12, 2020
8f2879e
capacity-optimized and 15 instance types
jagpk Dec 12, 2020
a795e42
Updated to reflect latest cosole changes
jagpk Dec 12, 2020
47ffa07
Merge branch 'master' of https://github.com/awslabs/ec2-spot-workshop…
jagpk Dec 12, 2020
2c739a9
Cloud9 Console Link
jagpk Dec 12, 2020
55eb74d
Cloud9 Images
jagpk Dec 12, 2020
7686f4f
Removed SIA Image
jagpk Dec 12, 2020
c44daf8
Cloud9
jagpk Dec 12, 2020
ab761cd
Cloud9
jagpk Dec 12, 2020
7bb1866
Savings Summary - 32 Task Spot Unit
jagpk Dec 12, 2020
2edf4a4
Removed Warning on old Spot limits
jagpk Dec 14, 2020
a936e93
Updated to 32 instances to support 4xl
jagpk Dec 14, 2020
6a917a2
Cloud9
jagpk Dec 14, 2020
4a695ad
Merge pull request #6 from jagpk/EMR-AllocationStrategies
jagpk Dec 15, 2020
9a6ab2f
PR Review
jagpk Jan 6, 2021
c2cff29
PR Review
jagpk Jan 7, 2021
91206f2
Spell Check
jagpk Jan 7, 2021
3d0aa2f
Merge pull request #7 from jagpk/EMR-AllocationStrategies
jagpk Jan 7, 2021
3348317
Format Fix
jagpk Jan 7, 2021
5b260d5
Merge pull request #8 from jagpk/EMR-AllocationStrategies
jagpk Jan 7, 2021
96a8e63
Format Changes
jagpk Jan 7, 2021
4c92a7c
Merge pull request #9 from jagpk/EMR-AllocationStrategies
jagpk Jan 7, 2021
7d6ffff
Format Changes
jagpk Jan 7, 2021
ef49d05
Format Changes
jagpk Jan 7, 2021
9ce6ece
Format Changes, replacing "\" with " "
jagpk Jan 8, 2021
5af0ebf
Merge pull request #10 from jagpk/EMR-AllocationStrategies
jagpk Jan 8, 2021
a8f97f7
Merge branch 'master' of https://github.com/awslabs/ec2-spot-workshop…
jagpk Jun 24, 2021
e28192e
Matching Index to Folder Name
jagpk Oct 5, 2021
8bc8533
Matching Index to Folder Name
jagpk Oct 5, 2021
ec87edd
Updaing folder names in all references
jagpk Oct 5, 2021
c7fd59b
Matching folder names to references
jagpk Oct 5, 2021
357855f
Updated HELM to K8S Tools
jagpk Oct 5, 2021
3d3ed01
Corrected to EKS managed node groups with Spot capacity
jagpk Oct 5, 2021
43f1b17
Corrected EKS Managed Node Groups Folder
jagpk Oct 5, 2021
fc70609
Renamed to EKS MNG with Spot
jagpk Oct 5, 2021
04d3c5b
Moved Self Managed to later
jagpk Oct 6, 2021
c780ec6
Image URL corrections
jagpk Oct 6, 2021
61f826e
Corrected Images URL
jagpk Oct 6, 2021
860a7a5
Cloud9 Updates
jagpk Oct 7, 2021
cdabf90
EKS cluster fixes
jagpk Oct 9, 2021
366dac7
Merge branch 'master' of https://github.com/jagpk/ec2-spot-workshops …
jagpk Oct 12, 2021
ab78de7
Updated Cluster Autoscaler to 1.21
jagpk Oct 12, 2021
d4c82bb
Self Managed Node Groups
jagpk Oct 13, 2021
55e3597
EKS MNGs
jagpk Oct 13, 2021
5184846
EKS Cluster Template
jagpk Oct 14, 2021
60d2f7b
Upgrade to EKS 1.21
jagpk Oct 21, 2021
2352146
EKS 1.21 upgrade
jagpk Oct 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cSpell.words": [
"Autoscaler",
"Kubernetes",
"Rebalance",
"Rebalancing",
"Tolerations"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ aws --version
```bash
aws ec2 create-key-pair --key-name emr-workshop-key-pair --query "KeyMaterial" --output text > emr-workshop-key-pair.pem
chmod 400 emr-workshop-key-pair.pem
```
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Start the workshop..."
title: "Start the workshop"
chapter: true
weight: 10
---

# Getting Started
To start the workshop, follow one of the following depending on whether you are...

* ...[running the workshop on your own (in your own account)]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/self_paced.md" >}}), or
* ...[attending an AWS hosted event (using AWS provided hashes)]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md" >}})
* ...[running the workshop on your own (in your own account)]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/self_paced.md" >}}), or
* ...[attending an AWS hosted event (using AWS provided hashes)]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/aws_event.md" >}})

Once you have completed with either setup, continue with **[Create a Workspace]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/workspace.md" >}})**
Once you have completed with either setup, continue with **[Create a Workspace]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/workspace.md" >}})**
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ hidden: true

## Attach the IAM role to your Workspace

1. Follow this [deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-eksworkshop;sort=desc:launchTime).
1. Click the grey circle button (in top right corner) and select **Manage EC2 Instance**.
![cloud9Role](/images/using_ec2_spot_instances_with_eks/prerequisites/cloud9-role.png)
1. Select the instance, then choose **Actions / Security / Modify IAM role**
![c9instancerole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png)
1. Choose **TeamRoleInstance** from the **IAM role** drop down, and select **Save**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ weight: 20
{{% notice warning %}}
Only complete this section if you are at an AWS hosted event (such as re:Invent,
Kubecon, Immersion Day, or any other event hosted by an AWS employee). If you
are running the workshop on your own, go to: [Start the workshop on your own]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/self_paced.md" >}}).
are running the workshop on your own, go to: [Start the workshop on your own]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/self_paced.md" >}}).
{{% /notice %}}

### Login to the AWS Workshop Portal
Expand Down Expand Up @@ -42,8 +42,6 @@ We have deployed the below resources required to get started with the workshop u

+ An EKS cluster with the name `eksworkshop-eksctl` and a [EKS managed node group](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) with 2 on-demand instances.

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/eksctl/create_eks_cluster_eksctl_command.md" %}}


#### Use your resources

Expand All @@ -65,9 +63,9 @@ you will notice additional Cloudformation stacks were also deployed which is the

- Click on the url against `Cloud9IDE` from the outputs

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/workspace_at_launch.md" %}}
{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/workspace_at_launch.md" %}}

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md" %}}
{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/update_workspace_settings.md" %}}

### Validate the IAM role {#validate_iam}

Expand All @@ -78,10 +76,10 @@ aws sts get-caller-identity

```

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_validaterole.md" %}}
{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/at_an_aws_validaterole.md" %}}

{{% notice note %}}
Since we have already setup the prerequisites, **you can head straight to [Test the Cluster]({{< relref "/using_ec2_spot_instances_with_eks/eksctl/test.md" >}})**
Since we have already setup the prerequisites, **you can head straight to [Test the Cluster]({{< relref "/using_ec2_spot_instances_with_eks/020_eksctl/test.md" >}})**
{{% /notice %}}

{{% /expand%}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for the download links.](https://docs.aws.amazon.com/eks/latest/userguide/gettin
#### Install kubectl

```
export KUBECTL_VERSION=v1.20.0
export KUBECTL_VERSION=v1.21.2
sudo curl --silent --location -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
sudo chmod +x /usr/local/bin/kubectl
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ hidden: true

## Attach the IAM role to your Workspace

1. Follow this [deep link to find your Cloud9 EC2 instance](https://console.aws.amazon.com/ec2/v2/home?#Instances:tag:Name=aws-cloud9-eksworkshop;sort=desc:launchTime).
1. Click the grey circle button (in top right corner) and select **Manage EC2 Instance**.
![cloud9Role](/images/using_ec2_spot_instances_with_eks/prerequisites/cloud9-role.png)
1. Select the instance, then choose **Actions / Security / Modify IAM role**
![c9instancerole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png)
1. Choose **eksworkshop-admin** from the **IAM role** drop down, and select **Save**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ Parameters:
C9KubectlVersion:
Description: Cloud9 instance kubectl version
Type: String
Default: v1.18.12
Default: v1.21.2
ConstraintDescription: Must be a valid kubectl version
C9KubectlVersionTEST:
Description: Cloud9 instance kubectl version
Type: String
Default: v1.18.12
Default: v1.21.2
ConstraintDescription: Must be a valid kubectl version
C9EKSctlVersion:
Description: Cloud9 instance eksctl version
Type: String
Default: 0.31.0
Default: v0.68.0
ConstraintDescription: Must be a valid eksctl version
EKSClusterVersion:
Description: EKS Cluster Vesion
Type: String
Default: 1.18
Default: 1.21
ConstraintDescription: Must be a valid eks version
EKSClusterName:
Description: EKS Cluster Name
Expand Down Expand Up @@ -277,7 +277,10 @@ Resources:
- sudo mv -v /tmp/eksctl /usr/local/bin
- sudo -H -u ec2-user /usr/local/bin/eksctl version
- echo '=== Create EKS Cluster ==='
- !Sub 'sudo -H -u ec2-user /usr/local/bin/eksctl create cluster --version=${EKSClusterVersion} --name=${EKSClusterName} --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS::Region} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access'
- wget -P /home/ec2-user/environment -O eksworkshop.yaml "https://raw.githubusercontent.com/awslabs/ec2-spot-workshops/master/content/using_ec2_spot_instances_with_eks/010_prerequisites/prerequisites.files/eksworkshop.yaml"
- sed 's/{AWS_REGION}/${AWS::Region}/' /home/ec2-user/environment/eksworkshop.yaml
- sed 's/{EKS_VERSION}/${EKSClusterVersion}/' /home/ec2-user/environment/eksworkshop.yaml
- !Sub 'sudo -H -u ec2-user /usr/local/bin/eksctl create cluster -f /home/ec2-user/environment/eksworkshop.yaml'
- sudo -H -u ec2-user /usr/local/bin/kubectl get nodes

C9BootstrapAssociation:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: eksworkshop-eksctl
region: ${AWS_REGION}
version: ${EKS_VERSION} # example "1.21"

managedNodeGroups:
- amiFamily: AmazonLinux2
instanceType: m5.large
name: mng-od-m5large
desiredCapacity: 2
maxSize: 3
minSize: 0
labels:
alpha.eksctl.io/cluster-name: eksworkshop-eksctl
alpha.eksctl.io/nodegroup-name: mng-od-m5large
intent: control-apps
tags:
alpha.eksctl.io/nodegroup-name: mng-od-m5large
alpha.eksctl.io/nodegroup-type: managed
k8s.io/cluster-autoscaler/node-template/label/intent: control-apps
ssh:
enableSsm: true
iam:
withAddonPolicies:
autoScaler: true
privateNetworking: true

# To enable all of the control plane logs, uncomment below:
# cloudWatch:
# clusterLogging:
# enableTypes: ["*"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight: 10
---

{{% notice warning %}}
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]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/aws_event.md" >}}).
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]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/aws_event.md" >}}).
{{% /notice %}}

### Running the workshop on your own
Expand Down Expand Up @@ -34,4 +34,4 @@ as an IAM user with administrator access to the AWS account:
![Login URL](/images/using_ec2_spot_instances_with_eks/prerequisites/iam-4-save-url.png)


Once you have completed the step above, **you can head straight to [Create a Workspace]({{< ref "/using_ec2_spot_instances_with_eks/prerequisites/workspace.md" >}})**
Once you have completed the step above, **you can head straight to [Create a Workspace]({{< ref "/using_ec2_spot_instances_with_eks/010_prerequisites/workspace.md" >}})**
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Starting from here, when you see command to be entered such as below, you will e

Please run this command to generate SSH Key in Cloud9. This key will be used on the worker node instances to allow ssh access if necessary.

```bash
```
ssh-keygen
```

Expand All @@ -20,6 +20,6 @@ Press `enter` 3 times to take the default choices

Upload the public key to your EC2 region:

```bash
```
aws ec2 import-key-pair --key-name "eksworkshop" --public-key-material fileb://~/.ssh/id_rsa.pub
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ chapter: false
weight: 60
---

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/update_workspace_settings.md" %}}
{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/update_workspace_settings.md" %}}

We should configure our aws cli with our current region as default:
```
Expand All @@ -17,5 +17,5 @@ aws configure set default.region ${AWS_REGION}
aws configure get default.region
```

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/prerequisites/validate_workspace_role.md" %}}
{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/validate_workspace_role.md" %}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Create EKS cluster Command"
chapter: false
disableToc: true
hidden: true
---
<!--
This markdown file is used as part of another file using 'insert-md-from-file' shortcode
-->

Create an eksctl deployment file (eksworkshop.yaml) to create an EKS cluster:

```
cat << EOF > eksworkshop.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
name: eksworkshop-eksctl
region: ${AWS_REGION}
version: "1.21"

managedNodeGroups:
- amiFamily: AmazonLinux2
instanceType: m5.large
name: mng-od-m5large
desiredCapacity: 2
maxSize: 3
minSize: 0
labels:
alpha.eksctl.io/cluster-name: eksworkshop-eksctl
alpha.eksctl.io/nodegroup-name: mng-od-m5large
intent: control-apps
tags:
alpha.eksctl.io/nodegroup-name: mng-od-m5large
alpha.eksctl.io/nodegroup-type: managed
k8s.io/cluster-autoscaler/node-template/label/intent: control-apps
iam:
withAddonPolicies:
autoScaler: true
privateNetworking: true

# To enable all of the control plane logs, uncomment below:
# cloudWatch:
# clusterLogging:
# enableTypes: ["*"]

EOF
```

Next, use the file you created as the input for the eksctl cluster creation.

```
eksctl create cluster -f eksworkshop.yaml
```

{{% notice info %}}
Launching EKS and all the dependencies will take approximately 15 minutes
{{% /notice %}}
39 changes: 39 additions & 0 deletions content/using_ec2_spot_instances_with_eks/020_eksctl/launcheks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "Launch EKS"
date: 2018-08-07T13:34:24-07:00
weight: 20
---


{{% notice warning %}}
**DO NOT PROCEED** with this step unless you have [validated the IAM role]({{< relref "../010_prerequisites/update_workspaceiam.md#validate_iam" >}}) in use by the Cloud9 IDE. You will not be able to run the necessary kubectl commands in the later modules unless the EKS cluster is built using the IAM role.
{{% /notice %}}

#### Challenge:
**How do I check the IAM role on the workspace?**

{{%expand "Expand here to see the solution" %}}

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/010_prerequisites/validate_workspace_role.md" %}}

If you do not see the correct role, please go back and **[validate the IAM role]({{< relref "../010_prerequisites/update_workspaceiam.md" >}})** for troubleshooting.

If you do see the correct role, proceed to next step to create an EKS cluster.
{{% /expand %}}


### Create an EKS cluster

{{% insert-md-from-file file="using_ec2_spot_instances_with_eks/020_eksctl/create_eks_cluster_eksctl_command.md" %}}

`eksctl create cluster` command allows you to create the cluster and managed nodegroups in sequence. There are a few things to note in the configuration that we just used to create the cluster and a managed nodegroup.

* Nodegroup configurations are set under the **managedNodeGroups** section, this indicates that the node group is managed by EKS.
* Nodegroup instance type is **m5.large** with **minSize** to 0, **maxSize** to 5 and **desiredCapacity** to 2. This nodegroup has capacity type set to On-Demand Instances by default.
* Notice that the we add 3 node labels:

* **alpha.eksctl.io/cluster-name**, to indicate the nodes belong to **eksworkshop-eksctl** cluster.
* **alpha.eksctl.io/nodegroup-name**, to indicate the nodes belong to **mng-od-m5large** nodegroup.
* **intent**, to allow you to deploy control applications on nodes that have been labeled with value **control-apps**

* Amazon EKS adds an additional Kubernetes label **eks.amazonaws.com/capacityType: ON_DEMAND**, to all On-Demand Instances in your managed node group. You can use this label to schedule stateful applications on On-Demand nodes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ weight: 10

For this module, we need to download the [eksctl](https://eksctl.io/) binary:
```
export EKSCTL_VERSION=0.51.0
export EKSCTL_VERSION=v0.68.0
curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${EKSCTL_VERSION}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

sudo mv -v /tmp/eksctl /usr/local/bin
Expand Down
Loading