Skip to content

s-u-b-h-a-k-a-r/aws-eks-vagrant-centos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

aws-eks-vagrant-centos

enter image description here

About...

This repository is used to create prerequisites that are required to access/create/delete Elastic Container Service For Kubernetes.

Table of Contents

Prerequisites

  • Enable Virtualization(VT) in BIOS for Hyper-V
  • Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository
  • Vagrant (Version >= 2.2.0) is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker containers, VMware, and AWS
  • Oracle VM VirtualBox (Version >= 6.0) lets you run multiple operating systems on Mac OS, Windows, Linux, or Oracle Solaris.
  • Minimum laptop/desktop configuration - 8GBRAM , 4CPU , support for VT-X

Install Vagrant Box

Default settings:env.yaml. These settings can be changed as per your requirements and the below are minimum requirements.

VM:
  password: aws-eks
  ip: 100.10.10.108
  cpus: 2
  memory: 2048
  vmname: aws-eks-centos
  hostname: aws-eks-centos.com

Open windows (OR) bash terminal from your local windows machine

  • $ git clone https://github.com/SubhakarKotta/aws-eks-vagrant-centos.git
  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant up

Vagrant Box Details

Name IP OS RAM CPU
aws-eks-centos 100.10.10.108 CentOS7 2G 2

Create EKS Cluster

Login to vagrant box from your local machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant ssh aws-eks-centos
  • $ sudo su

Provide AWS Credentials

  • $ aws configure
  • ............... AWS Access Key ID [None]:
  • ............... AWS Secret Access Key [None]:
  • ............... Default region name [None]:
  • ............... Default output format [None]:

Create EKS Cluster

  • $ eksctl create cluster --version=1.11 --name=<YOUR_CLUSTER_NAME> --region=<YOUR_REGION_NAME> --nodes-min=<MIN_NODES> --nodes-max=<MAX_NODES> --node-type=m4.xlarge --tags Owner=<YOUR_NAME>

Install Tiller

  • $ kubectl --namespace kube-system create serviceaccount tiller
  • $ kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
  • $ helm init --service-account tiller --upgrade

Install kubernetes dashboard by following the steps given in the link

Access Kubernetes Dashboard by following the steps given in the link

Access Kubernetes Dashboard

From local system execute the below commands

Use the below command to generate access token login to Dashboard

  • $ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')

Start proxy to access kubernetes dashboard

  • $ kubectl proxy

Click ! http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

enter image description here

![Watch the video]

Access EKS Cluster

Login to vagrant box from your local machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant ssh aws-eks-centos
  • $ sudo su

Provide AWS Credentials

  • $ aws configure
  • ............... AWS Access Key ID [None]:
  • ............... AWS Secret Access Key [None]:
  • ............... Default region name [None]:
  • ............... Default output format [None]:

Fetch/Update kubeconfig on your vagrant box

  • $ aws eks --region <region> update-kubeconfig --name <cluster_name>

Verify Nodes

  • $ kubectl get nodes [Verify kubectl is connected to eks cluster]

Access Kubernetes Dashboard by following the steps given in the link

Delete EKS Cluster

Login to vagrant box from your local machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant ssh aws-eks-centos
  • $ sudo su

Provide AWS Credentials

  • $ aws configure
  • ............... AWS Access Key ID [None]:
  • ............... AWS Secret Access Key [None]:
  • ............... Default region name [None]:
  • ............... Default output format [None]:

Delete EKS Cluster When the cluster is no longer needed, use the eksctl delete cluster command to remove all the related resources.

  • $ eksctl delete cluster --name=<YOUR_CLUSTER_NAME> --region=<YOUR_REGION_NAME>

Add-Ons provided

Login Vagrant VM

The Vagrant VM can be accessed in two ways from your local windows machine

vagrant ssh

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant ssh aws-eks-centos

putty/mobaxterm

  • 100.10.10.108 [vagrant/vagrant (Or) root/aws-eks]

Stop Vagrant VM

Run the below command to stop the Vagrant Box from your local windows machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant halt

Restart Vagrant VM

Run the below command to restart the Vagrant Box if the vagrant box is stopped from your local windows machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant up

Destroy Vagrant VM

Run the below command to delete the Vagrant Box from your local windows machine

  • $ cd aws-eks-vagrant-centos/provisioning
  • $ vagrant destroy

Example

Here we will see a simple example creating a EKS cluster in us-east-2 region

Understand the parameters that we are going to authenticate AWS.

  • AWS Access Key <access key to authenticate AWS>
  • AWS Secret Access Key <secret access key to authenticate AWS>
  • Default Region name <region where we are going to create cluster>
  • Default output format <we can leave this empty>

Run the below command to authenticate AWS Credentials

  • $ aws configure
  • ............... AWS Access Key ID [None]:AKIAI4MUM3N25AHL3O5Q
  • ............... AWS Secret Access Key [None]:vpdLw5bt1MatG012Teqy6Cy0if1UTC++t3SCGBXW
  • ............... Default region name [None]: us-east-2
  • ............... Default output format [None]:

Understand the parameters that we are going to pass to create EKS Cluster

  • --version <Kubernetes Version that AWS Supports>
  • --name <Name of the EKS Cluster>
  • --region <Region that you are going to create cluster>
  • --nodes-min <Mimimum number of EC2 instances in EKS Cluster>
  • --nodes-min <Maximum number of EC2 instances in EKS Cluster>
  • --node-type <The configuration of each EC2 machine with what CPU and MEMRORY should be>
  • --tags <The tag that needs to be added in each resource that will be created with EKS Cluster i.e who added, what is the purpose etc>

Run the below command to create new EKS Cluster

  • $ eksctl create cluster --version=1.11 --name=my-pega-cluster --region=us-east-2 --nodes-min=2 --nodes-max=5 --node-type=m4.xlarge --tags Owner=pega

To learn more about eksctl parameters please check the below link which has full details.

About

This repository is used to create prerequisites that are required to access/create/delete Elastic Container Service For Kubernetes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages