Skip to content

Commit 65b766c

Browse files
committed
initial commit migrating from brentley/eksworkshop
adding step to create service-linked role for ELB (#29) vend fontawesome/create service linked role (#30) * adding step to create service-linked role for ELB * vend fontawesome ourselves since they are down minor fixes - install npm and clarity in installation (#31) adding fontawesome to the package list (#32) initial commit migrating from brentley/eksworkshop adding step to create service-linked role for ELB (#29) vend fontawesome/create service linked role (#30) * adding step to create service-linked role for ELB * vend fontawesome ourselves since they are down minor fixes - install npm and clarity in installation (#31) adding fontawesome to the package list (#32) removing terraform
1 parent 806927a commit 65b766c

File tree

121 files changed

+7275
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+7275
-4
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public/
2+
npm-debug.log
3+
node_modules
4+
public
5+
terraform/.terraform
6+
terraform.tfstate
7+
terraform.tfstate.backup

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "themes/learn"]
2+
path = themes/learn
3+
url = https://github.com/matcornic/hugo-theme-learn.git

README.md

+56-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,59 @@
1-
## EKS Workshop
1+
master branch: ![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUmYrQzlvK2JVYWloK3N5NFh5WUZNS1duYUtVeFN2eWJLNk9VdU9NdzdDdGtobldPcHBKYjdVQ0YxV0NQLzRZeXhWbkJVTkc2Ymd2TEpJblNYb1BraXFNPSIsIml2UGFyYW1ldGVyU3BlYyI6IjRObVVDcVUyb3JJUEFYQTciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
22

3-
AWS Workshop tutorials for EKS
3+
jenkinsworld branch: ![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUmYrQzlvK2JVYWloK3N5NFh5WUZNS1duYUtVeFN2eWJLNk9VdU9NdzdDdGtobldPcHBKYjdVQ0YxV0NQLzRZeXhWbkJVTkc2Ymd2TEpJblNYb1BraXFNPSIsIml2UGFyYW1ldGVyU3BlYyI6IjRObVVDcVUyb3JJUEFYQTciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=jenkinsworld)
44

5-
## License Summary
5+
tigera branch: ![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUmYrQzlvK2JVYWloK3N5NFh5WUZNS1duYUtVeFN2eWJLNk9VdU9NdzdDdGtobldPcHBKYjdVQ0YxV0NQLzRZeXhWbkJVTkc2Ymd2TEpJblNYb1BraXFNPSIsIml2UGFyYW1ldGVyU3BlYyI6IjRObVVDcVUyb3JJUEFYQTciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=tigera)
6+
7+
# eksworkshop
8+
9+
### Setup:
10+
11+
#### Install Hugo:
12+
On a mac:
13+
14+
`brew install hugo`
15+
16+
On Linux:
17+
- Download from the releases page: https://github.com/gohugoio/hugo/releases/tag/v0.46
18+
- Extract and save the executable to `/usr/local/bin`
19+
20+
#### Clone this repo:
21+
From wherever you checkout repos:
22+
`git clone [email protected]:aws-samples/eks-workshop.git` (or your fork)
23+
24+
#### Clone the theme submodule:
25+
`cd eksworkshop`
26+
27+
`git submodule init` ;
28+
`git submodule update`
29+
30+
#### Install Node.js and npm:
31+
You can follow instructions from npm website: https://www.npmjs.com/get-npm
32+
33+
#### Install node packages:
34+
`npm install`
35+
36+
#### Run Hugo locally:
37+
`npm run server`
38+
or
39+
`npm run drafts` to see stubbed in draft pages.
40+
41+
`npm run build` will build your content locally and output to ./public/`
42+
`npm run test` will test the built content for bad links
43+
44+
#### View Hugo locally:
45+
Visit http://localhost:1313/ to see the site.
46+
47+
#### Making Edits:
48+
As you save edits to a page, the site will live-reload to show your changes.
49+
50+
#### Auto Deploy:
51+
Any commits to master will auto build and deploy in a couple of minutes. You can see the currently
52+
deployed hash at the bottom of the menu panel.
53+
54+
Any commits to a branch will auto build and deploy in a couple of minutes to a custom route named with the branch name. You can see the currently
55+
deployed hash at the bottom of the menu panel.
56+
An example is the "jenkinsworld" branch would be deployed to https://eksworkshop.com/jenkinsworld/
57+
58+
note: shift-reload may be necessary in your browser to reflect the latest changes.
659

7-
This sample code is made available under a modified MIT license. See the LICENSE file.

archetypes/default.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: {{ .Date }}
4+
draft: true
5+
---
6+

codebuild-deploy.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -vex
4+
[ -n "${PRIMARY_BUCKET}" ] || exit 1
5+
[ -n "${CODEBUILD_GIT_CLEAN_BRANCH}" ] || exit 1
6+
[ -n "${CLOUDFRONT}" ] || exit 1
7+
8+
set +vx
9+
10+
PRIMARY_BUCKET=$(echo $PRIMARY_BUCKET | cut -f1,2 -d.)
11+
12+
if [ "$CODEBUILD_GIT_CLEAN_BRANCH" = "master" ] ; then
13+
aws s3 sync public/ s3://${PRIMARY_BUCKET}/ --cache-control 'max-age=3600, public' --exclude '*' --include '*.html' --include '*.xml';
14+
aws s3 sync public/ s3://${PRIMARY_BUCKET}/ --cache-control 'max-age=86400, public' --exclude '*.html' --exclude '*.xml';
15+
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT} --paths /\*
16+
else
17+
export DEPLOY_DIR=${CODEBUILD_GIT_CLEAN_BRANCH};
18+
aws s3 sync public/ s3://${PRIMARY_BUCKET}/${DEPLOY_DIR}/ --delete --cache-control 'max-age=3600, public' --exclude '*' --include '*.html' --include '*.xml';
19+
aws s3 sync public/ s3://${PRIMARY_BUCKET}/${DEPLOY_DIR}/ --delete --cache-control 'max-age=86400, public' --exclude '*.html' --exclude '*.xml';
20+
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT} --paths /${DEPLOY_DIR}\*
21+
fi

config.toml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
baseURL = "https://eksworkshop.com/"
2+
languageCode = "en-us"
3+
defaultContentLanguage = "en"
4+
title = "Amazon EKS Workshop"
5+
theme = "learn"
6+
uglyurls = false
7+
googleAnalytics = "UA-44634850-4"
8+
sectionPagesMenu = "main"
9+
pygmentsCodeFences = false
10+
pygmentsCodeFencesGuessSyntax = false
11+
pygmentsStyle = "monokai"
12+
13+
14+
[blackfriday]
15+
hrefTargetBlank = true
16+
17+
[params]
18+
themeVariant = "mine"
19+
showVisitedLinks = false
20+
author = "Brent Langston"
21+
description = "Amazon EKS Workshop"
22+
disableSearch = false
23+
disableAssetsBusting = false
24+
disableLanguageSwitchingButton = true
25+
disableShortcutsTitle=true
26+
disableInlineCopyToClipBoard = true
27+
28+
#
29+
30+
[menu]
31+
[[menu.main]]
32+
identifier = "Prerequisites"
33+
name = "This is the Mu track"
34+
title = "Workshop using Mu"
35+
url = "/mu/"
36+
weight = -110
37+
38+
[[menu.shortcuts]]
39+
name = "<i class='fab fa-twitter fa-lg'></i> @brentContained"
40+
identifier = "ol"
41+
url = "https://twitter.com/intent/user?screen_name=brentContained"
42+
weight = 1
43+
44+
[[menu.shortcuts]]
45+
name = "<i class='fab fa-twitter fa-lg'></i> @omarlari"
46+
identifier = "bl"
47+
url = "https://twitter.com/intent/user?screen_name=omarlari"
48+
weight = 2
49+
50+
[[menu.shortcuts]]
51+
name = "<i class='fab fa-twitter fa-lg'></i> @MandusMomberg"
52+
identifier = "mm"
53+
url = "https://twitter.com/intent/user?screen_name=MandusMomberg"
54+
weight = 3
55+
56+
[[menu.shortcuts]]
57+
name = "<i class='fab fa-twitter fa-lg'></i> @christopherhein"
58+
identifier = "ch"
59+
url = "https://twitter.com/intent/user?screen_name=christopherhein"
60+
weight = 4
61+
62+
[outputs]
63+
home = [ "HTML", "JSON"]
64+
page = [ "HTML" ]

content/_index.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Amazon EKS Workshop"
3+
chapter: true
4+
weight: 1
5+
---
6+
7+
<div style="text-align: center"><h2>Amazon EKS Workshop</h2></div>
8+
9+
![EKS](images/3-service-animated.gif)
10+
11+
In this workshop, we will explore multiple ways to configure VPC, ALB, and EC2
12+
Kubernetes workers, and Amazon Elastic Container Service for Kubernetes.

content/cleanup/_index.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Cleanup"
3+
chapter: true
4+
weight: 70
5+
---
6+
7+
# Cleanup
8+
![Cleaned Environment](/images/cleanup.svg)

content/cleanup/cloudformation.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "Cleanup the CloudFormation Cluster"
3+
date: 2018-08-07T12:37:34-07:00
4+
weight: 10
5+
draft: true
6+
---
7+
To clean up the resources in your AWS account created by this workshop.
8+
Run the following commands:
9+
10+
Remove the Worker nodes from EKS:
11+
```
12+
aws cloudformation delete-stack --stack-name "eksworkshop-cf-worker-nodes"
13+
```
14+
Delete the EKS Cluster:
15+
```
16+
aws eks delete-cluster --name "eksworkshop-cf"
17+
```
18+
Confirm the Cluster is deleted before removing Cluster VPC:
19+
```
20+
aws eks describe-cluster --name eksworkshop-cf --query "cluster.status"
21+
```
22+
Remove the Cluster VPC:
23+
```
24+
aws cloudformation delete-stack --stack-name "eksworkshop-cf"
25+
```
26+
Detach IAM Policies from Role:
27+
```
28+
aws iam detach-role-policy --role-name "eks-service-role-workshop" --policy-arn "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
29+
aws iam detach-role-policy --role-name "eks-service-role-workshop" --policy-arn "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
30+
```
31+
Remove the IAM Role created for the EKS cluster:
32+
```
33+
aws iam delete-role --role-name "eks-service-role-workshop"
34+
```

content/cleanup/eksctl.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Delete the EKSCTL Cluster"
3+
date: 2018-08-07T13:37:53-07:00
4+
weight: 30
5+
---
6+
7+
In order to delete the resources created for this EKS cluster, run the following commands:
8+
9+
Delete the cluster:
10+
```
11+
eksctl delete cluster --name=eksworkshop-eksctl
12+
```
13+
14+
{{% notice tip %}}
15+
The nodegroup will have to complete the deletion process before the EKS cluster
16+
can be deleted. The total process will take approximately 15 minutes, and can be monitored via the
17+
[CloudFormation Console](https://console.aws.amazon.com/cloudformation/home)
18+
{{% /notice %}}

content/cleanup/others.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "Cleanup the Other Clusters"
3+
date: 2018-08-07T12:37:34-07:00
4+
weight: 5
5+
draft: true
6+
---
7+
8+
**If you haven't removed the earlier clusters already**, make sure to delete the first two clusters we created:
9+
10+
[Follow the instructions here to delete the cluster we created with eksctl.](/eksctl/cleanup.html)
11+
12+
[Follow the instructions here to delete the cluster we created with terraform.](/terraform/cleanup.html)
13+
14+
[Follow the instructions here to delete the cluster we created with terraform.](/cloudformation/cleanup.html)

content/cleanup/undeploy.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Undeploy the applications"
3+
date: 2018-08-07T13:37:53-07:00
4+
weight: 20
5+
---
6+
7+
To delete the resources created by the applications, we should delete the application
8+
deployments and kubernetes dashboard:
9+
10+
Undeploy the applications:
11+
```
12+
cd ~/environment/ecsdemo-frontend
13+
kubectl delete -f kubernetes/service.yaml
14+
kubectl delete -f kubernetes/deployment.yaml
15+
16+
cd ~/environment/ecsdemo-crystal
17+
kubectl delete -f kubernetes/service.yaml
18+
kubectl delete -f kubernetes/deployment.yaml
19+
20+
cd ~/environment/ecsdemo-nodejs
21+
kubectl delete -f kubernetes/service.yaml
22+
kubectl delete -f kubernetes/deployment.yaml
23+
24+
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
25+
26+
```

content/cleanup/workspace.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "Cleanup the Workspace"
3+
chapter: false
4+
weight: 50
5+
---
6+
7+
Let's delete our SSH key:
8+
```
9+
aws ec2 delete-key-pair --key-name "eksworkshop"
10+
```
11+
12+
Since we no longer need the Cloud9 instance to have Administrator access
13+
to our account, we can delete the role we created:
14+
15+
- Go to [the IAM Console](https://console.aws.amazon.com/iam/home?#/roles/eksworkshop-admin)
16+
- Click **Delete role** in the upper right corner
17+
18+
Finally, let's delete our Cloud9 EC2 Instance:
19+
20+
- Go to your [Cloud9 Environment](https://console.aws.amazon.com/cloud9/home)
21+
- Select the environment named **eksworkshop** and pick **delete**

content/cloudformation/_index.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "Launch using CloudFormation"
3+
chapter: true
4+
weight: 40
5+
draft: true
6+
---
7+
8+
# Launch Using CloudFormation
9+
10+
AWS Officially provides several resources for building EKS and supporting
11+
infrastructure.
12+
13+
In this Chapter, we will take a look at the official CloudFormation method
14+
of Launching EKS.

content/cloudformation/configmap.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: "Create the Worker ConfigMap"
3+
date: 2018-08-07T12:00:40-07:00
4+
weight: 70
5+
draft: true
6+
---
7+
8+
The file found in the repository at *assets/worker-configmap.yml* contains a
9+
configmap we can use for our EKS workers. We need to substitute our instance
10+
role ARN into the template:
11+
12+
View the template:
13+
```
14+
cd ${HOME}/environment/howto-launch-eks-workshop/
15+
16+
cat assets/worker-configmap.yml
17+
```
18+
Lookup and store the Instance ARN:
19+
```
20+
export INSTANCE_ARN=$(aws cloudformation describe-stacks --stack-name "eksworkshop-cf-worker-nodes" --query "Stacks[0].Outputs[?OutputKey=='NodeInstanceRole'].OutputValue" --output text)
21+
22+
echo INSTANCE_ARN=$INSTANCE_ARN
23+
```
24+
25+
Test modify the template to see what changes:
26+
```
27+
sed "s@.*rolearn.*@ - rolearn: $INSTANCE_ARN@" assets/worker-configmap.yml
28+
```
29+
Actually apply the configmap:
30+
```
31+
sed "s@.*rolearn.*@ - rolearn: $INSTANCE_ARN@" assets/worker-configmap.yml | kubectl apply -f /dev/stdin
32+
```

content/cloudformation/eks.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "Create the EKS Cluster"
3+
date: 2018-08-07T09:42:43-07:00
4+
weight: 40
5+
draft: true
6+
---
7+
8+
To build the EKS cluster, we need to tell the EKS service which IAM Service role
9+
to use, and which Subnets and Security Group to use. We can gather this information
10+
from our previous labs where we built the IAM role and VPC:
11+
12+
```
13+
export SERVICE_ROLE=$(aws iam get-role --role-name "eks-service-role-workshop" --query Role.Arn --output text)
14+
15+
export SECURITY_GROUP=$(aws cloudformation describe-stacks --stack-name "eksworkshop-cf" --query "Stacks[0].Outputs[?OutputKey=='SecurityGroups'].OutputValue" --output text)
16+
17+
export SUBNET_IDS=$( aws cloudformation describe-stacks --stack-name "eksworkshop-cf" --query "Stacks[0].Outputs[?OutputKey=='SubnetIds'].OutputValue" --output text)
18+
```
19+
20+
Let's confirm the variables are now set in our environment:
21+
```
22+
echo SERVICE_ROLE=${SERVICE_ROLE}
23+
echo SECURITY_GROUP=${SECURITY_GROUP}
24+
echo SUBNET_IDS=${SUBNET_IDS}
25+
```
26+
27+
Now we can create the EKS cluster:
28+
```
29+
aws eks create-cluster --name eksworkshop-cf --role-arn "${SERVICE_ROLE}" --resources-vpc-config subnetIds="${SUBNET_IDS}",securityGroupIds="${SECURITY_GROUP}"
30+
```
31+
{{% notice info %}}
32+
Cluster provisioning usually takes less than 10 minutes.
33+
{{% /notice %}}
34+
35+
You can query the status of your cluster with the following command:
36+
```
37+
aws eks describe-cluster --name "eksworkshop-cf" --query cluster.status --output text
38+
```
39+
40+
When your cluster status is **ACTIVE** you can proceed.

0 commit comments

Comments
 (0)