Here are the pre-requisites for the Kubernetes on AWS workshop:
You will be using an AWS Account while you go through the workshop. Create an AWS Account if you don’t already have one.
Please ensure you followed all sign up steps. If you don’t do this, then you likely run into the following error while completing the step to set the AWS Availability Zones:
An error occurred (OptInRequired) when calling the DescribeAvailabilityZones operation: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe
Note
|
You will incur charges as you go through these workshop guides as it will exceed the limits of AWS free tier. An estimate of charges (<$20/day) can be seen at this simple monthly calculator. |
Install the latest version of the AWS CLI and the Kubernetes CLI on your machine.
Provision and install AWS CLI on a Mac OS via homebrew.
-
Install homebrew and cask
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Install AWS CLI
brew install awscli
-
Install Kubectl CLI
$ brew install kubernetes-cli
If you already have Kubectl CLI installed, then you just need to update it:
$ brew upgrade kubernetes-cli
The Windows 10 Linux subsystem is required if you are using Windows 10.
Install Windows 10 Linux subsystem as explained at https://msdn.microsoft.com/en-us/commandline/wsl/install_guide.
The lab has been tested with Windows 10. A similar Unix shell on other Windows machines may work.
-
Install the AWS CLI + Follow this document: http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html
-
Install or Upgrade Kubectl CLI:
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl $ chmod +x kubectl && sudo mv kubectl /usr/local/bin/
If you already have an AWS Account, you need to create an IAM user to use during the workshop. If you have not created an IAM admin user and group yet, please do so in the following section. If you already have admin user then skip to Create IAM user for workshop
Please go to https://console.aws.amazon.com/iam/home#/users and click on Add user
. As a username choose Administrator
, select the Programmatic access
checkbox and hit Next: Permissions
.
In the next dialog select Create group
, choose Administrators
, select the AdministratorAccess
policy and click Create group
.
Finally click Next: Review
and Create user
in the final dialog.
Now you see your newly admin user and group together with the Access key ID
. To see the Secret access key
once, click on Show
next to the stars.
To login from the console run aws configure
and enter the required values. It will look like this:
$ aws configure
AWS Access Key ID [None]: *****
AWS Secret Access Key [None]: *****
Default region name [None]: eu-central-1
Default output format [None]:
Run the following commands on CLI to create the needed group and user:
$ aws iam create-group --group-name k8s-workshop
$ aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess --group-name k8s-workshop
$ aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonRoute53FullAccess --group-name k8s-workshop
$ aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --group-name k8s-workshop
$ aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/IAMFullAccess --group-name k8s-workshop
$ aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonVPCFullAccess --group-name k8s-workshop
$ aws iam create-user --user-name k8s-workshop
$ aws iam add-user-to-group --user-name k8s-workshop --group-name k8s-workshop
$ aws iam create-access-key --user-name k8s-workshop
Now run aws configure
again and use the Access Key ID
and Secret Access Key
from the newly created user.
Please review this link for additional info on IAM permissions
Different availability zones for this region can be set in the environment variable AWS_AVAILABILITY_ZONES
using the following command:
export AWS_AVAILABILITY_ZONES="$(aws ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName' --output text | awk -v OFS="," '$1=$1')"
Echo the value of the environment variable to confirm:
echo $AWS_AVAILABILITY_ZONES eu-central-1a,eu-central-1b,eu-central-1c
Several parts of the workshop require the region or availability zones to be explicitly specified as a CLI option. The region is picked based upon the value set in aws configure
command. The environment variable $AWS_AVAILABILITY_ZONES
is used to set the availability zones.
The workshop repo has configuration files that are used to create Kubernetes resources. You need to clone the repo to have access to those files:
$ git clone https://github.com/aws-samples/aws-workshop-for-kubernetes
Please file a bug if you run into issues.