Giter VIP home page Giter VIP logo

terraform-eks-task's Introduction

Terraform EKS Cluster Setup

This Terraform repository provides an example setup for deploying an Amazon EKS cluster into an existing VPC. The setup includes configurations to allow pods within the EKS cluster to assume IAM roles, enabling them to access AWS resources such as S3 buckets.

Prerequisites

Before you begin, ensure you have the following prerequisites in place:

  • Terraform installed on your machine.
  • AWS CLI installed and configured with your AWS credentials.
  • An existing VPC with subnets where you plan to deploy the EKS cluster.
  • An S3 bucket created that you want to grant access to from the pods in the EKS cluster.

Usage

Follow these steps to deploy the EKS cluster and configure pod IAM role assumption:

  1. Clone the Repository:

    Clone this repository to your local machine using the following commands:

    git clone https://github.com/travka/terraform-eks-task.git
    cd terraform-eks-task
  2. Configure Variables:

    Open the variables.tf file and adjust the variables according to your preferences and requirements. You can modify the EKS cluster's region, name, version, VPC CIDR block, and other settings. Make sure to review and customize the variables before proceeding.

  3. Initialize Terraform:

    Initialize Terraform to download the required provider plugins and modules:

    terraform init
  4. Deploy the EKS Cluster:

    Deploy the EKS cluster and related resources using Terraform:

    terraform apply
  5. Configure kubectl:

    Configure kubectl to work with the newly created EKS cluster:

    aws eks --region <your-region> update-kubeconfig --name <eks-cluster-name>
  6. Deploy a Sample Pod:

    Use the following sample YAML configuration (sample-pod.yaml) to deploy a pod within the EKS cluster. Replace <your-service-account-name> with the actual service account name:

    apiVersion: v1
    kind: Pod
    metadata:
      name: sample-pod
    spec:
      containers:
        - name: sample-container
          image: amazonlinux:latest
          command: ["sleep", "3600"]
      automountServiceAccountToken: true
      serviceAccountName: <your-service-account-name>

    Apply the sample pod configuration:

    kubectl apply -f sample-pod.yaml
  7. Verify S3 Access:

    Verify that the pod can access the specified S3 bucket:

    kubectl exec -it sample-pod -- aws s3 ls s3://your-bucket-name
  8. Clean Up:

    When you're done experimenting, don't forget to clean up the resources:

    terraform destroy

Further Resources


Maintained by travka

terraform-eks-task's People

Contributors

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