Skip to content

charlesadamasceno/eks

Repository files navigation

prerequisites

IAM user and permissions

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:

  1. 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
  1. 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

create IAM role

  • 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

create keypair

  • 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 API Access key/-secret

  • create key+secret via AWS console AWS-console => IAM => Users => => tab Security credentials => button Create access key

Prerequisites awscli

  • Python3 or Python2.7.9+
  • Python Pip3 / Pip

Install awscli

linux based system

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=json

Windows, using Anaconda

after 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

TEST

aws --version

Setup of eksctl

Installation

for 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/bin

This utility will use the same credentials file as we explored for the AWS cli, located under '~/.aws/credentials'

Test

eksctl version


kubectl - the commandline K8s tool

install _kubectl

  • 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

check kubectl

  • Linux:
    kubectl version --short --client
  • Windows:
    kubectl.exe version --short --client

About

AWS EKS Course - Kubernetes management

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors