Git Product home page Git Product logo

eks's Introduction

Deploy and Manage Kubernetes Cluster in AWS - EKS Cluster

Amazon Elastic Kubernetes Service (Amazon EKS) gives you the flexibility to start, run, and scale Kubernetes applications in the AWS cloud.

Prerequisites

Mandatory:
Optional but recommended:
  • kubectl
  • wget (required for the eks module)

HLD - Terraform template and tfvars to manage AWS EKS Cluster

HLD TF EKS

Usage

Create a Terraform variable (.tfvars) file containing the following parameters
$ vim my.tfvars
## AWS params and creds
AWS_ACCESS_KEY_ID="<AWS_ACCESS_KEY>"
AWS_SECRET_ACCESS_KEY="<AWS_SECRET_ACCESS_KEY>"
# AWS Region to use, by default "eu-west-3"
AWS_REGION="<AWS_REGION>"

## Cluster params
# Master Name is the name that will be used to prefix all AWS Component (VPC,  to setup your deployment
MASTER_NAME="<MASTER_NAME>"
# Kubernetes version to use, by default "1.20"
K8s_VERSION="<Kubernetes_Version>"
# Type of EC2 instance to use for Worker node
INSTANCE_TYPE="t3.medium"
# MINIMUM WORKER NODE
MIN_WORKER_NODE="3"
# MAXIMUM WORKER NODE
MAX_WORKER_NODE="3"
# DESIRED WORKER NODE
DESIRED_WORKER_NODE="3"

Deploy & Manage

Use Terraform to deploy EKS Cluster

Init and download Terraform plugin and Module
$ terraform init
Plan the deployment and visualize what will be deployed and the changes
$ terraform plan -var-file="<tfvars file>"
Apply the deployment
$ terraform apply -var-file="<tfvars file>"
Destroy the deployment
$ terraform destroy -var-file="<tfvars file>"

Troubleshooting the deployment

Sometimes, depending on the size of the deployed cluster (type of instance, number of nodes defined in the parameters of the EKS cluster), it is possible that the terraform apply falls in error after reaching the timeout. Don't panic, just restart the terraform apply.

Example of errors
│ Error: Error making request: Get "https://BD627AEA2C596BA986969096F8594EC7.gr7.us-east-1.eks.amazonaws.com/healthz": EOF
│
│   with module.eks.data.http.wait_for_cluster[0],
│   on .terraform\modules\eks\cluster.tf line 68, in data "http" "wait_for_cluster":
│   68: data "http" "wait_for_cluster" {
Re Apply the deployment
$ terraform apply -var-file="<tfvars file>"

Connect to EKS Cluster

Show the clusters in AWS
chris@toolbox-chris:~/certs$ aws eks list-clusters --region us-east-1
{
    "clusters": [
        "eks-k8s-chrisley-5c76224e9d"
    ]
}
Update kubeconfig
chris@toolbox-chris:~/certs$ aws eks --region us-east-1 update-kubeconfig --name eks-k8s-chrisley-5c76224e9d
Check the new EKS Cluster context is well set and active in kubeconfig (the one with "*" is active)
chris@toolbox-chris:~/certs$ kubectl config get-contexts
CURRENT   NAME                                                                     CLUSTER                                                                  AUTHINFO                                                                 NAMESPACE
*         arn:aws:eks:us-east-1:005915627013:cluster/eks-k8s-chrisley-5c76224e9d   arn:aws:eks:us-east-1:005915627013:cluster/eks-k8s-chrisley-5c76224e9d   arn:aws:eks:us-east-1:005915627013:cluster/eks-k8s-chrisley-5c76224e9d
          chris-k8s-01                                                             chris-k8s-01                                                             chris-k8s-01
          chris-k8s-01-worker1-rancher                                             chris-k8s-01-worker1-rancher                                             chris-k8s-01

Your cluster is now ready and available. You can deploy applications with kubectl, helm, etc....

Optional - Use Lens IDE to manage your cluster

Download and install LENS Kubernetes IDE

LENS

Setup your cluster in LENS

LENS-SETUP

Manage your cluster with LENS

LENS-MANAGE

eks's People

Contributors

chrisley75 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.