All Projects → chankh → eksutil

chankh / eksutil

Licence: Apache-2.0 license
Sample project to call Kubernetes API of an Amazon EKS cluster from AWS Lambda

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to eksutil

eks
AWS EKS - kubernetes project
Stars: ✭ 149 (+473.08%)
Mutual labels:  lambda, eks
home-energy-monitor
ESP32-based Home Energy Monitor
Stars: ✭ 152 (+484.62%)
Mutual labels:  lambda
kula
Lightweight and highly extensible .NET scripting language.
Stars: ✭ 43 (+65.38%)
Mutual labels:  lambda
leto-serverless
Angular server(less) side rendering
Stars: ✭ 13 (-50%)
Mutual labels:  lambda
aws-sam-typescript-layers-example
Example project for developing AWS Lambda functions on TypeScript with all goodies: local development, tests, debugging, shared layers (3rd party and your own), and deploy.
Stars: ✭ 168 (+546.15%)
Mutual labels:  lambda
ecs-drain-lambda
Automation of Draining ECS instances with Lambda, based on Autoscaling Group Lifecycle hooks or Spot Instance Interruption Notices
Stars: ✭ 56 (+115.38%)
Mutual labels:  lambda
formidable-serverless
Enables use of formidable (node.js module for parsing form data, especially file uploads) in serverless environments.
Stars: ✭ 28 (+7.69%)
Mutual labels:  lambda
telegram-stepfunctions-bot
Serverless Telegram bot made on 4 AWS Lambda chained by AWS Step Functions. All of this written on Serverless Framework using plugins.
Stars: ✭ 26 (+0%)
Mutual labels:  lambda
lifecycle-manager
Graceful AWS scaling event on Kubernetes using lifecycle hooks
Stars: ✭ 89 (+242.31%)
Mutual labels:  eks
serverless-apollo-datasource-redis
Serverless Apollo Server 2 with cached Datasource in Redis
Stars: ✭ 26 (+0%)
Mutual labels:  lambda
GoblinDB
Fear the Goblin! - An amazing, simple and fun database for humans
Stars: ✭ 54 (+107.69%)
Mutual labels:  lambda
my-cluster
My Kubernetes cluster
Stars: ✭ 27 (+3.85%)
Mutual labels:  eks
serverless-media-portal
Ready-to-deploy webapp for sharing home videos: a React frontend with a AWS Lambda backend using FFmpeg to process videos. Created using Serverless Framework.
Stars: ✭ 90 (+246.15%)
Mutual labels:  lambda
aws-nestjs-starter
Serverless, AWS, NestJS, GraphQL and DynamoDB starter
Stars: ✭ 200 (+669.23%)
Mutual labels:  lambda
terraform-aws-lambda-auto-package
A terraform module to define a lambda function which source files are automatically built and packaged for lambda deployment.
Stars: ✭ 23 (-11.54%)
Mutual labels:  lambda
scanii-lambda
A Sam-Packaged AWS Lambda client to the scanii.com content processing service
Stars: ✭ 25 (-3.85%)
Mutual labels:  lambda
ssm-agent-daemonset-installer
A DaemonSet to apply configuration to Kubernetes worker nodes after they've been bootstrapped.
Stars: ✭ 19 (-26.92%)
Mutual labels:  eks
lambda-acm-validate
Automatically validate ACM requests with Lambda
Stars: ✭ 34 (+30.77%)
Mutual labels:  lambda
terraform-aws-lambda
A Terraform module to create AWS Lambda ressources.
Stars: ✭ 40 (+53.85%)
Mutual labels:  lambda
aws-turn-off-my-account
📦 🚀 📦 Lambda stack to turn off and destroy all resources from your personal AWS Account to avoid billing surprises
Stars: ✭ 63 (+142.31%)
Mutual labels:  lambda

EKS Lambda Sample

This code repository aims to be a reference sample for implementing AWS Lambda function to interact with Amazon Elastic Container Services for Kubernetes (EKS) using Kubernetes API. Amazon EKS runs the Kubernetes management infrastructure for you across multiple AWS availability zones to eliminate a single point of failure. Amazon EKS is certified Kubernetes conformant so you can use existing tooling and plugins from partners and the Kubernetes community. Applications running on any standard Kubernetes environment are fully compatible and can be easily migrated to Amazon EKS.

Having a AWS Lambda function that integrates with Amazon EKS would allow event-driven triggers to manage and modify deployments and other controls within the Amazon EKS cluster.

While this is just a sample that list the pods running within the Amazon EKS cluster, you can modify the code to meet your needs.

Prequisites

This sample requires the go compiler and dep to build. Refer to this Getting Started Guide and installing dep for detailed instructions.

List of Samples

  • listpods - Most basic example of using this utility to list pods running in an Amazon EKS cluster.
  • codepipeline - Demonstration of Continuous Deployment using AWS CodePipeline to deploy an application to an Amazon EKS cluster.
  • drainer - Amazon EKS node drainer with AWS Lambda that respond to Spot Termination signal from AWS CloudWatch events and perform taint-based eviction on the terminating node.

Configuring RBAC

You would also need to give the Lambda execution role permissions in Amazon EKS cluster. Refer to this User Guide for detailed instructions.

  1. Edit the aws-auth ConfigMap of your cluster.
$ kubectl -n kube-system edit configmap/aws-auth
  1. Add your Lambda execution role to the config
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  mapRoles: |
    - rolearn: arn:aws:iam::555555555555:role/devel-worker-nodes-NodeInstanceRole-74RF4UBDUKL6
      username: system:node:{{EC2PrivateDNSName}}
      groups:
        - system:bootstrappers
        - system:nodes
    - rolearn: arn:aws:iam::<AWS Account ID>:role/<your lambda execution role>
      username: admin
      groups:
        - system:masters

For your Lambda execution role, you will need permissions to describe EKS cluster. Add the following statement to the IAM role.

{
    "Effect": "Allow",
    "Action": [
        "eks:DescribeCluster"
    ],
    "Resource": "*"
}

You may want to be more restrictive by specifying only the arn of your EKS cluster for resource field.

Once these are configured, you can test your function. Good luck!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].