Giter Site home page Giter Site logo

quick-eks-cross-az's Introduction

Quick EKS cross az

This script helps estimating cross az data transfer costs in EKS clusters.

The script is based on an existing AWS open solution. It simplifies operations by using your current AWS role directly from your shell session, and without using any iam:* permission...

Features

  • Runs With Your Current AWS Credentials: Uses the AWS credentials and settings you already have configured in your shell session. No need to configure special credentials just for the demo.
  • Works Without Administrator Privileges: No need for IAM modification permissions - it's designed to work seamlessly with PowerUser access.
  • Reuses Your EKS Authentication: Uses the active Kubernetes context in your shell to retrieve pod and node metadata.
  • Simple Exectuion: Offers one-line execution with pipx or docker for all orchestration including cleanup.

Technical Details

Similar to the original solution, this project utilizes CloudFormation to provision flow logs and S3 buckets. However, it orchestrates everything using a script:

  • Flow logs are temporarily enabled for the EKS VPC, and necessary S3 buckets are created via CloudFormation.
  • Pod metadata, including the app label and node IP, is gathered.
  • After a configurable timeframe, flow logs are aggregated within Athena.
  • The results are downloaded as a CSV file.
  • Finally, the script cleans up any infrastructure changes made.

Getting Started

Prerequisites

  • Python version 3.6 or later
  • Kubernetes Cluster API access in current shell
  • An active AWS role in your current shell that has permissions to:
    • Create flow logs
    • Create S3 buckets
    • Run Athena queries

Using Pipx

Easiest way to run the script is with pipx. Pipx lets you run Python packages quickly in isolation:

python3 -m pip install --user pipx # install pipx if required
python3 -m pipx run quick-eks-cross-az --help

Using Docker

docker run  -v ~/.kube/config:/kube/config -e KUBECONFIG=/kube/config -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN  asafamr123/quick-eks-cross-az --help

CLI

usage: cli.py [-h] [--minutes N] [--quiet | --no-quiet] [--verbose | --no-verbose] [--cleanup]
              [--output OUTPUT] [--stack-name STACK_NAME]

Quick EKS Cross AZ Log. This script measures cross-AZ (Cross Availability Zone) traffic for EKS (Elastic
Kubernetes Service) using flow logs and data from the active Kubernetes context. It can be used to
estimate associated costs. Full docs are here: https://github.com/asafamr/quick-eks-cross-az

options:
  -h, --help            show this help message and exit
  --minutes N           set the duration for flow logs accumulation in minutes (default: 15)
  --quiet, --no-quiet   run without manual confirmation (default: False)
  --verbose, --no-verbose
                        verbose log (default: False)
  --cleanup             clean up a previous interrupted run (default: False)
  --output OUTPUT       specify output file name (default: cross-az.csv)
  --stack-name STACK_NAME
                        override CloudFormation stack name (default: quick-eks-cross-az

quick-eks-cross-az's People

Contributors

asafamr-mm avatar asafamr 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.