Skip to content

Commit

Permalink
Merge pull request #125 from jagpk/master
Browse files Browse the repository at this point in the history
Updated ReadMe and Index files
Upgraded EKS to 1.18
Upgraded EKSCTL to 0.31.0, KUBECTL to 1.18.12 and Cluster Autoscaler to 1.18.3 to support EKS 1.18
Upgraded Metrics Server to 2.11.4, Kube Ops View to 1.19.3 and AWS Node Termination Handler to 0.12.0
Updated screenshots to reflect latest EC2 Instances console UI, specific to adding instance role to Cloud9 EC2 instance.
  • Loading branch information
ruecarlo authored Nov 25, 2020
2 parents 1b82fe8 + 6f59842 commit 3fdfa7c
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Ec2 Spot Workshops
## EC2 Spot Workshops

Collection of workshops to demonstrate best practices in using Amazon EC2 Spot Instances. https://aws.amazon.com/ec2/spot/

Expand Down
8 changes: 4 additions & 4 deletions content/using_ec2_spot_instances_with_eks/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ weight: 50
pre: "<b>⁃ </b>"
---

In this workshop, you learn how to provision, manage, and maintain your Amazon Kubernetes
clusters with Amazon EKS at any scale on Spot Instances to architect for optimizations on cost and scale.
We dive deep using hands-on material to provision and scale worker nodes, handle
interruptions, and design for fault tolerance.
In this workshop, you will learn how to provision, manage, and maintain your Kubernetes
clusters with Amazon Elastic Kubernetes Service (Amazon EKS) at any scale on Spot Instances to architect for optimizations on cost and scale.
We will dive deep using hands-on material to provision and scale worker nodes, handle
Spot interruptions, and design for fault tolerance.

This workshop is originally based on AWS [EKS Workshop](https://eksworkshop.com/). You can find
there more modules and learn about other Amazon Elastic Kubernetes Service best practices.
Expand Down
15 changes: 3 additions & 12 deletions content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ If you do see the correct role, proceed to next step to create an EKS cluster.

### Create an EKS cluster

The following command will create an eks cluster with the name `eksworkshop-eksctl`
.It will also create a nodegroup with 2 on-demand instances.
The following command will create an eks cluster with the name `eksworkshop-eksctl`. It will also create a nodegroup with 2 on-demand instances.

```
eksctl create cluster --version=1.16 --name=eksworkshop-eksctl --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS_REGION} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access
eksctl create cluster --version=1.18 --name=eksworkshop-eksctl --node-private-networking --managed --nodes=2 --alb-ingress-access --region=${AWS_REGION} --node-labels="lifecycle=OnDemand,intent=control-apps" --asg-access
```

eksctl allows us to pass parameters to initialize the cluster. While initializing the cluster, eksctl does also allow us to create nodegroups.
Expand All @@ -52,12 +51,4 @@ The managed nodegroup will have two m5.large nodes and it will bootstrap with th
Launching EKS and all the dependencies will take approximately **15 minutes**
{{% /notice %}}

The command above, created a **Managed Nodegroup**. [Amazon EKS managed node groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) automate the provisioning and lifecycle management of nodes. Managed Nodegroups use the latest [EKS-optimized AMIs](https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html). The node run in your AWS account provisioned as apart of an EC2 Auto Scaling group that is managed for you by Amazon EKS. This means EKS takes care of the lifecycle management and undifferentiated heavy lifting on operations such as node updates, handling of terminations, gracefully drain of nodes to ensure that your applications stay available.








The command above, created a **Managed Nodegroup**. [Amazon EKS managed node groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html) automate the provisioning and lifecycle management of nodes. Managed Nodegroups use the latest [EKS-optimized AMIs](https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html). The node run in your AWS account provisioned as apart of an EC2 Auto Scaling group that is managed for you by Amazon EKS. This means EKS takes care of the lifecycle management and undifferentiated heavy lifting on operations such as node updates, handling of terminations, gracefully drain of nodes to ensure that your applications stay available.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ weight: 10

For this module, we need to download the [eksctl](https://eksctl.io/) binary:
```
export EKSCTL_VERSION=0.23.0
curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${EKSCTL_VERSION}/eksctl_Linux_amd64.tar.gz" | tar xz -C /tmp
export EKSCTL_VERSION=0.31.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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Metrics Server is a cluster-wide aggregator of resource usage data. These metric
kubectl create namespace metrics
helm install metrics-server \
stable/metrics-server \
--version 2.10.0 \
--version 2.11.4 \
--namespace metrics
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Homebrew on macOS.
Download the `stable` repository so we have something to start with:

```sh
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo add stable https://charts.helm.sh/stable/
helm repo update
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ helm install kube-ops-view \
stable/kube-ops-view \
--set service.type=LoadBalancer \
--set nodeSelector.intent=control-apps \
--version 1.2.4 \
--set rbac.create=True
```

Expand All @@ -32,8 +33,8 @@ helm list

should display :
```
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
kube-ops-view 1 Sun Sep 22 11:47:31 2019 DEPLOYED kube-ops-view-1.1.0 0.11 default
NAME NAMESPACE REVISION UPDATED STATUS CHART
kube-ops-view default 1 2020-11-20 05:16:47 deployed kube-ops-view-1.2.4
```

With this we can explore kube-ops-view output by checking the details about the newly service created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +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-.*workshop.*;sort=desc:launchTime)
1. Select the instance, then choose **Actions / Instance Settings / Attach/Replace IAM Role**
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. 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 **Apply**
1. Choose **TeamRoleInstance** from the **IAM role** drop down, and select **Save**
![c9attachrole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png)
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ for the download links.](https://docs.aws.amazon.com/eks/latest/userguide/gettin
{{% /notice %}}

#### Install kubectl

```
export KUBECTL_VERSION=v1.16.12
export KUBECTL_VERSION=v1.18.12
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 All @@ -31,4 +32,4 @@ for command in kubectl jq envsubst
do
which $command &>/dev/null && echo "$command in path" || echo "$command NOT FOUND"
done
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ hidden: true

## Create an IAM role for your Workspace

1. Follow [this deep link to create an IAM role with Administrator access.](https://console.aws.amazon.com/iam/home#/roles$new?step=review&commonUseCase=EC2%2BEC2&selectedUseCase=EC2&policies=arn:aws:iam::aws:policy%2FAdministratorAccess)
1. Confirm that **AWS service** and **EC2** are selected, then click **Next** to view permissions.
1. Follow this [deep link to create an IAM role with Administrator access](https://console.aws.amazon.com/iam/home#/roles$new?step=review&commonUseCase=EC2%2BEC2&selectedUseCase=EC2&policies=arn:aws:iam::aws:policy%2FAdministratorAccess).
1. Confirm that **AWS service** and **EC2** are selected, then click **Next: Permisssions** to view permissions.
1. Confirm that **AdministratorAccess** is checked, then click **Next: Tags** to assign tags.
1. Take the defaults, and click **Next: Review** to review.
1. Enter **eksworkshop-admin** for the Name, and click **Create role**.
![createrole](/images/using_ec2_spot_instances_with_eks/prerequisites/createrole.png)

## 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-.*workshop.*;sort=desc:launchTime)
1. Select the instance, then choose **Actions / Instance Settings / Attach/Replace IAM Role**
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. 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 **Apply**
1. Choose **eksworkshop-admin** from the **IAM role** drop down, and select **Save**
![c9attachrole](/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png)
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ rules:
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["watch","list","get"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get","list","watch","create","update"]

---
apiVersion: rbac.authorization.k8s.io/v1beta1
Expand Down Expand Up @@ -129,7 +132,7 @@ spec:
nodeSelector:
intent: control-apps
containers:
- image: us.gcr.io/k8s-artifacts-prod/autoscaling/cluster-autoscaler:v1.16.5
- image: us.gcr.io/k8s-artifacts-prod/autoscaling/cluster-autoscaler:v1.18.3
name: cluster-autoscaler
resources:
limits:
Expand Down Expand Up @@ -166,6 +169,4 @@ spec:
volumes:
- name: ssl-certs
hostPath:
path: "/etc/ssl/certs/ca-bundle.crt"


path: "/etc/ssl/certs/ca-bundle.crt"
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This also is our recommendation. Remember the termination handler does also hand
helm repo add eks https://aws.github.io/eks-charts
helm install aws-node-termination-handler \
--namespace kube-system \
--version 0.12.0 \
eks/aws-node-termination-handler
```

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3fdfa7c

Please sign in to comment.