diff --git a/README.md b/README.md index a78a969a..8241da1b 100644 --- a/README.md +++ b/README.md @@ -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/ diff --git a/content/using_ec2_spot_instances_with_eks/_index.md b/content/using_ec2_spot_instances_with_eks/_index.md index cf560eba..89edc2fb 100644 --- a/content/using_ec2_spot_instances_with_eks/_index.md +++ b/content/using_ec2_spot_instances_with_eks/_index.md @@ -5,10 +5,10 @@ weight: 50 pre: "" --- -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. diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md b/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md index be7f7c18..1303c51f 100644 --- a/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md +++ b/content/using_ec2_spot_instances_with_eks/eksctl/launcheks.md @@ -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. @@ -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. \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md b/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md index 81807283..368c1bef 100644 --- a/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md +++ b/content/using_ec2_spot_instances_with_eks/eksctl/prerequisites.md @@ -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 ``` diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md b/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md index ed246485..a9eff3b9 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/deploy_metric_server.md @@ -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 ``` diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md b/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md index 2688a037..9281d637 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/helm_deploy.md @@ -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 ``` diff --git a/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md b/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md index 0f8f5444..460b5ffd 100644 --- a/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md +++ b/content/using_ec2_spot_instances_with_eks/helm_root/install_kube_ops_view.md @@ -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 ``` @@ -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. diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md b/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md index b7843343..3c6808cf 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/at_an_aws_updateiam.md @@ -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) diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md b/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md index 1eb4f9f8..4ea3454c 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/k8stools.md @@ -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 ``` @@ -31,4 +32,4 @@ for command in kubectl jq envsubst do which $command &>/dev/null && echo "$command in path" || echo "$command NOT FOUND" done -``` +``` \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md b/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md index 9d8f5250..5afbf2a7 100644 --- a/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md +++ b/content/using_ec2_spot_instances_with_eks/prerequisites/on_your_own_updateiam.md @@ -7,8 +7,8 @@ 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**. @@ -16,8 +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-.*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) \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml b/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml index d0dbebc5..bdc128b0 100644 --- a/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml +++ b/content/using_ec2_spot_instances_with_eks/scaling/deploy_ca.files/cluster_autoscaler.yml @@ -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 @@ -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: @@ -166,6 +169,4 @@ spec: volumes: - name: ssl-certs hostPath: - path: "/etc/ssl/certs/ca-bundle.crt" - - + path: "/etc/ssl/certs/ca-bundle.crt" \ No newline at end of file diff --git a/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md b/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md index 63116a58..ad928a37 100644 --- a/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md +++ b/content/using_ec2_spot_instances_with_eks/spotworkers/deployhandler.md @@ -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 ``` diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png index fc26e681..ea680dac 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachrole.png differ diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png index 83a9e668..00d5c2ac 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9attachroleee.png differ diff --git a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png index cde240a7..bf00acb8 100644 Binary files a/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png and b/static/images/using_ec2_spot_instances_with_eks/prerequisites/c9instancerole.png differ