Skip to content

Commit

Permalink
Updated Kubernetes version to 1.23 + minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegolubev committed Sep 8, 2022
1 parent ff23449 commit a672cbd
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions content/amazon-ec2-spot-cicd-workshop/gitlab-spot/010-prep.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ aws sts get-caller-identity --query Arn | grep GitLabWorkshopC9Role && echo -e "

![Cloud9 Screenshot: Caller identity](/images/gitlab-spot/Cloud9-CallerIdentity.png)

7. During the workshop, you will need to refer to the identifiers of the resources created by the CloudFormation stack you deployed. To reduce copy and paste across the CloudFormation console and the Cloud9 environment, you will load the CloudFormation Stack Outputs to environment variables. Configure the stack_name environment variable with the name of your CloudFormation template:
7. During the workshop, you will need to refer to the identifiers of the resources created by the CloudFormation stack you deployed. To reduce copy and paste across the CloudFormation console and the Cloud9 environment, you will load the CloudFormation Stack Outputs to environment variables. Configure the stack_name environment variable with the name of your CloudFormation template (substitute the `mod-gitlab-spot-workshop` with the actual stack name that you created / identified in the [Starting the workshop](before.html) section):
```
export stack_name=mod-gitlab-spot-workshop
```
Expand Down Expand Up @@ -60,4 +60,4 @@ Subnet1Zone : us-east-1a

![Cloud9 Screenshot: Show hidden files](/images/gitlab-spot/Cloud9-ShowHiddenFiles.png)

You are now ready to start the main sections of the workshop! Please proceed to [**Create a GitLab repository**](lab1.html).
You are now ready to start the main sections of the workshop! Please proceed to [**Create a GitLab repository**](020-create-gitlab-repo.html).
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export ECR_NAME=$(echo $ECR_INFO | awk -F'/' '{print $2}')
sed "s/\${ECR_ADDRESS}/${ECR_ADDRESS}/g" template-gitlab-ci.yml | sed "s/\${ECR_NAME}/${ECR_NAME}/g" | sed "s/\${AWS_REGION}/${REGION}/g" > .gitlab-ci.yml
```

3. In the file tree on the left open file `amazon-ec2-spot-cicd-workshop/gitlab-spot/demo-app/.gitlab-ci.yml` (if you don't see it, make sure you have enabled the hidden files in [**Workshop Preparation**](prep.html)). Look through it to understand what it does.
4. Define your name and email that will be used in Git (replace `Your Name` and `[email protected]` with the values you prefer):
3. In the file tree on the left open file `amazon-ec2-spot-cicd-workshop/gitlab-spot/demo-app/.gitlab-ci.yml` (if you don't see it, make sure you have enabled the hidden files in [**Workshop Preparation**](010-prep.html)). Look through it to understand what it does.
4. Return to the terminal tab and execute the following commands to define your name and email that will be used in Git (replace `Your Name` and `[email protected]` with the values you prefer):

```
git config --global user.name "Your Name"
Expand All @@ -72,4 +72,4 @@ git add .
git commit -m "Initial commit"
```

You are now ready to do the key step in configuring GitLab CI/CD on Spot instances: add the runners. Please proceed to [**Configure GitLab runners on Spot instances**](lab2.html).
You are now ready to do the key step in configuring GitLab CI/CD on Spot instances: add the runners. Please proceed to [**Configure GitLab runners on Spot instances**](030-configure-gitlab-runners-on-spot.html).
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are also other ways to create GitLab runners on spot instances that we are

### Create an IAM role for GitLab Runners

1. Create the trust policy document named ec2-role-trust-policy.json.
1. Create the trust policy document named `ec2-role-trust-policy.json`.
```
cat << EOF > ~/environment/ec2-role-trust-policy.json
{
Expand All @@ -26,7 +26,7 @@ cat << EOF > ~/environment/ec2-role-trust-policy.json
EOF
```

2. Create the **gitlab-runner** role and specify the trust policy that you created using the create-role command.
2. Create the **gitlab-runner** role and specify the trust policy that you created using the `create-role` command.
```
aws iam create-role \
--role-name gitlab-runner \
Expand Down Expand Up @@ -196,7 +196,7 @@ You will now get the runner configuration information from GitLab and then start
11. In the **The S3 bucket that will be used for a shared runner cache.** leave the default value (do not enter the GitLabCacheBucket value you saved from CloudFormation Output values, as at the moment the template will still try to create policies using the custom bucket and will fail if a different one is provided).
12. In the **The number of instances that should be configured. Generally 1 for warm HA and 2 for hot HA.** enter `2`.
13. In the **Override automatic IAM Instance Profile for a precreated one.** type `gitlab-runner`.
14. In the **The VPC in the account and region should be used**, get the VPC ID by running below command in Cloud9:
14. In the **The VPC in the account and region should be used**, get the VPC ID (in the format `vpc-...`) by running below command in Cloud9:
```
echo VPC ID = $VPC
```
Expand Down Expand Up @@ -226,4 +226,4 @@ You had to use the full template to customize the IAM role used by the runners.

![GitLab Screenshot: Runner available](/images/gitlab-spot/GitLab-RunnerAvailable.png)

You can now proceed to build your application in [**Building the demo app**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/lab3.html).
You can now proceed to build your application in [**Building the demo app**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/040-building-demo-app.html).
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight = 40

In this lab you will push the changes to your origin repository and verify that the pipeline has successfully finished both in GitLab and by checking the image in Amazon ECR.

1. Return to the browser tab with Cloud9 and execute the following command in the terminal. Specify `root` as the username and the same password you used in [**Create a GitLab repository**](lab1.html) to log in to GitLab:
1. Return to the browser tab with Cloud9 and execute the following command in the terminal. Specify `root` as the username and the same password you used in [**Create a GitLab repository**](020-create-gitlab-repo.html) to log in to GitLab:

```
git push -u origin main
Expand All @@ -22,11 +22,11 @@ git push -u origin main

![ECR Console Screenshot: Images](/images/gitlab-spot/AWSConsole-ECRImages.png)

You have successfully built the image and can now proceed to [**Deploying Amazon EKS on Spot instances**](lab4.html).
You have successfully built the image and can now proceed to [**Deploying Amazon EKS on Spot instances**](050-deploying-eks-on-spot.html).

### Challenges

If this and previous labs seemed too easy, try completing the following challenges:
If this and previous sections of the workshop seemed too easy, try completing the following challenges:

**Challenge 1:** Configure shared runners for the whole GitLab CI/CD and not just the current repository. Create an additional repository and verify that your runners serve it too.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Terraform files are located in `~/environment/amazon-ec2-spot-cicd-workshop/
1. Return to the browser tab with Cloud9 and execute the following commands in the terminal to download and install `kubectl` that you will be using to work with the Kubernetes cluster:
```
cd ~/environment
export KUBECTL_VERSION=v1.22.10
export KUBECTL_VERSION=v1.23.7
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 @@ -27,7 +27,7 @@ terraform apply
```

3. When asked for the parameters, enter the following values:
* **kubernetes_version**: enter `1.22`
* **kubernetes_version**: enter `1.23`
* **vpc_id**: open a new terminal in Cloud9 and run below command to get the VPC ID
```
echo VPC ID = $VPC
Expand Down Expand Up @@ -92,7 +92,7 @@ EoF
kubectl apply -f aws-auth.yaml
```
You are now ready for the final steps to deploy your demo application into the cluster in [**Installing the demo app into Amazon EKS**](lab5.html).
You are now ready for the final steps to deploy your demo application into the cluster in [**Installing the demo app into Amazon EKS**](060-deploy-app-to-eks.html).
### Challenge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ weight = 60

In this section you will deploy the demo application you built earlier in the new Amazon EKS cluster deployed fully on spot instances.

1. In the Cloud9 file tree on the left open file `amazon-ec2-spot-cicd-workshop/gitlab-spot/demo-app/.gitlab-ci.yml` (if you don't see it, make sure you have enabled the hidden files in [**Workshop Preparation**](prep.html)).
1. In the Cloud9 file tree on the left open file `amazon-ec2-spot-cicd-workshop/gitlab-spot/demo-app/.gitlab-ci.yml` (if you don't see it, make sure you have enabled the hidden files in [**Workshop Preparation**](010-prep.html)).

2. Change the jobs `deploy_to_eks` and `test_on_eks` to the following ones:
```
Expand All @@ -16,7 +16,7 @@ deploy_to_eks:
- aws --version
- aws eks update-kubeconfig --region $REGION --name $K8S_CLUSTER_NAME
- apt-get install -y gettext # To get envsubst
- export KUBECTL_VERSION=v1.22.10
- export KUBECTL_VERSION=v1.23.7
- curl --silent --location -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
- chmod +x /usr/local/bin/kubectl
script:
Expand Down Expand Up @@ -112,4 +112,4 @@ To view the current economy from using spot instances instead of on-demand ones
2. Choose **Spot Requests** in the **Instances** section of the navigation pane.
3. Choose **Savings summary**.

You can now clean all the resources created during the workshop using the steps in [**Workshop Cleanup**](cleanup.html).
You can now clean all the resources created during the workshop using the steps in [**Workshop Cleanup**](070-cleanup.html).
14 changes: 7 additions & 7 deletions content/amazon-ec2-spot-cicd-workshop/gitlab-spot/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ This workshop will be broken down into a series of sections that flow on from ea
The exercises that will be covered are:

* [Starting the workshop](gitlab-spot/before.html) where you will log in to AWS accounts and deploy GitLab, if it is not yet deployed
* [Workshop Preparation](gitlab-spot/prep.html) where you will save GitLab access details and create an AWS Cloud9 environment to execute the workshop steps
* [Create a GitLab repository](gitlab-spot/lab1.html) where you will create a repository in GitLab CI/CD and create a demo application.
* [Configure GitLab runners on Spot instances](gitlab-spot/lab2.html) where you will deploy the GitLab Runners in an auto-scaling group on spot instances
* [Building the demo app](gitlab-spot/lab3.html) where you will push the changes and make sure that your pipeline executes successfully.
* [Deploying Amazon EKS on Spot instances](gitlab-spot/lab4.html) where you will create a new Kubernetes cluster in Amazon EKS that will only have worker nodes on spot instances
* [Installing the demo app into Amazon EKS](gitlab-spot/lab5.html) where you will modify your GitLab CI/CD scripts to add a stage of deploying on Amazon EKS and test the result
* [Workshop Cleanup](gitlab-spot/cleanup.html) where you will remove all the resources created during the workshop
* [Workshop Preparation](gitlab-spot/010-prep.html) where you will save GitLab access details and create an AWS Cloud9 environment to execute the workshop steps
* [Create a GitLab repository](gitlab-spot/020-create-gitlab-repo.html) where you will create a repository in GitLab CI/CD and create a demo application.
* [Configure GitLab runners on Spot instances](gitlab-spot/030-configure-gitlab-runners-on-spot.html) where you will deploy the GitLab Runners in an auto-scaling group on spot instances
* [Building the demo app](gitlab-spot/040-building-demo-app.html) where you will push the changes and make sure that your pipeline executes successfully.
* [Deploying Amazon EKS on Spot instances](gitlab-spot/050-deploying-eks-on-spot.html) where you will create a new Kubernetes cluster in Amazon EKS that will only have worker nodes on spot instances
* [Installing the demo app into Amazon EKS](gitlab-spot/060-deploy-app-to-eks.html) where you will modify your GitLab CI/CD scripts to add a stage of deploying on Amazon EKS and test the result
* [Workshop Cleanup](gitlab-spot/070-cleanup.html) where you will remove all the resources created during the workshop

The final architecture that we will be building looks the following way:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ To start the workshop, follow one of the following pages, depending on whether y

{{% children %}}

Once you are done with either setup, continue with [**Workshop Preparation**](prep.html).
Once you are done with either setup, continue with [**Workshop Preparation**](010-prep.html).
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ In the next section we will get the login details of the GitLab environment that

If there is no CloudFormation stack present, provision it as specified in the section [**...On your own**](self_paced.html).

You can now proceed to the [**Workshop Preparation**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/prep.html) where you will save the required output values from the stack.
You can now proceed to the [**Workshop Preparation**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/010-prep.html) where you will save the required output values from the stack.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ Now you will deploy a GitLab without any runners. As it is not the purpose of th
6. In the **Stack name** field enter `mod-gitlab-spot-workshop`, in the **EEKeyPair** field select `ee-default-key-pair` or the name of the key you used in the steps above. Leave the default values in other fields and choose **Next**.
7. Choose **Next**.
8. Mark the checkbox **I acknowledge that AWS CloudFormation might create IAM resources.** and choose **Create stack**.
9. Wait until the stack is in `CREATE_COMPLETE` status (it should take approximately 15 minutes) and continue with [**Workshop Preparation**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/prep.html).
9. Wait until the stack is in `CREATE_COMPLETE` status (it should take approximately 15 minutes) and continue with [**Workshop Preparation**](/amazon-ec2-spot-cicd-workshop/gitlab-spot/010-prep.html).
Binary file modified static/images/gitlab-spot/Cloud9-TerraformVars.png
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 a672cbd

Please sign in to comment.