To be able to run through this course your IAM user needs to have certain privileges to e.g. create all the required resources and objects. According AWS Best Practices you should never use your root account for working with AWS services. E.g. to demonstrate the Hands-On lectures, the user eks-course has been used.
There are 2 attempts to follow:
- provide admin access
login with an admin of your AWS account go to "IAM" => "users" => click on your user => "Permissions" => "Add permission" => then search for AdministratorAccess and attach this policy
Basically your user just requires one policy being attached
- AdministratorAccess
- provide a dedicated list of privileges/policies
to cover all the required privileges, first you have to create additional policies
EKS-Admin-policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"eks:*"
],
"Resource": "*"
}
]
}
CloudFormation-Admin-policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:*"
],
"Resource": "*"
}
]
}
finally, assign the following policies to your IAM user you are going to use throughout the course:
- AmazonEC2FullAccess
- IAMFullAccess
- AmazonVPCFullAccess
- CloudFormation-Admin-policy
- EKS-Admin-policy
where the last 2 policies are the ones you created above
- open
https://console.aws.amazon.com/iam/and choose Roles => create role - choose EKS service followed by Allows Amazon EKS to manage your clusters on your behalf
- choose Next: Permissions
- click Next: Review
- enter a unique Role name, EKS-course-role and click Create Role
- open EC2 dashboard
https://console.aws.amazon.com/ec2 - click KeyPairs in left navigation bar under section "Network&Security"
- click Create Key Pair
- provide name for keypair, eks-course and click Create
- !! the keypair will be downloaded immediately => file eks-course.pem !!
- create key+secret via AWS console AWS-console => IAM => Users => => tab Security credentials => button Create access key
- Python3 or Python2.7.9+
- Python Pip3 / Pip
pip install --user awscli
export PATH=$PATH:/home/$(whoami)/.local/bin--user is used to install the awscli under your home directory, not to interfere with any existing libraries/installations
create file ~/.aws/credentials
[default]
aws_access_key_id=###
aws_secret_access_key=###
region=us-east-1
output=jsonafter Anaconda python distribution, goto "Start" => "Anaconda" => "open anaconda shell"
# potentially upgrade pip first
python -m pip install --upgrade pip
pip install --user awscli
set path=%path%;c:\users\<<username>>\appdata\roaming\python\python37\scripts
aws --versionfor non-Linux OS you can find a binary download here:
https://github.com/weaveworks/eksctl/releases
on Linux, you can just execute:
curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/latest_release/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/binThis utility will use the same credentials file as we explored for the AWS cli, located under '~/.aws/credentials'
eksctl version
-
kubectl
- on RH based Linux:
sudo dnf install kubernetes-clientcat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOF yum install -y kubectl
- on Debian/Ubuntu:
sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt-get update sudo apt-get install -y kubectl
- on Windows, open a terminal emulator, preferrably MobaXterm:
curl -k -# -o kubectl.exe https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/windows/amd64/kubectl.exe chmod +x kubectl.exe mkdir $HOME/bin mv kubectl.exe $HOME/bin echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc source .bashrc
- Linux:
kubectl version --short --client - Windows:
kubectl.exe version --short --client