amazon-k8s-node-drainer | Gracefully drain Kubernetes pods from EKS worker nodes | Function As A Service library

 by   aws-samples Python Version: Current License: Non-SPDX

kandi X-RAY | amazon-k8s-node-drainer Summary

kandi X-RAY | amazon-k8s-node-drainer Summary

amazon-k8s-node-drainer is a Python library typically used in Serverless, Function As A Service applications. amazon-k8s-node-drainer has no bugs, it has no vulnerabilities and it has low support. However amazon-k8s-node-drainer build file is not available and it has a Non-SPDX License. You can download it from GitHub.

This sample code provides a means to gracefully terminate nodes of an Amazon Elastic Container Service for Kubernetes (Amazon EKS) cluster when managed as part of an Amazon EC2 Auto Scaling Group. The code provides an AWS Lambda function that integrates as an Amazon EC2 Auto Scaling Lifecycle Hook. When called, the Lambda function calls the Kubernetes API to cordon and evict all evictable pods from the node being terminated. It will then wait until all pods have been evicted before the Auto Scaling group continues to terminate the EC2 instance. The lambda may be killed by the function timeout before all evictions complete successfully, in which case the lifecycle hook may re-execute the lambda to try again. If the lifecycle heartbeat expires then termination of the EC2 instance will continue regardless of whether or not draining was successful. You may need to increase the function and heartbeat timeouts in template.yaml if you have very long grace periods. Using this approach can minimise disruption to the services running in your cluster by allowing Kubernetes to reschedule the pod prior to the instance being terminated enters the TERMINATING state. It works by using Amazon EC2 Auto Scaling Lifecycle Hooks to trigger an AWS Lambda function that uses the Kubernetes API to cordon the node and evict the pods. NB: The lambda function created assumes that the Amazon EKS cluster's Kubernetes API server endpoint has public access enabled, if your endpoint only has private access enabled then you must modify the template.yml file to ensure the lambda function is running in the correct VPC and subnet. This lambda can also be used against a non-EKS Kubernetes cluster by reading a kubeconfig file from an S3 bucket specified by the KUBE_CONFIG_BUCKET and KUBE_CONFIG_OBJECT environment variables. If these two variables are passed in then Drainer function will assume this is a non-EKS cluster and the IAM authenticator signatures will not be added to Kubernetes API requests. It is recommended to apply the principle of least privilege to the IAM role that governs access between the Lambda function and S3 bucket.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              amazon-k8s-node-drainer has a low active ecosystem.
              It has 188 star(s) with 61 fork(s). There are 20 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 8 have been closed. On average issues are closed in 35 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of amazon-k8s-node-drainer is current.

            kandi-Quality Quality

              amazon-k8s-node-drainer has 0 bugs and 10 code smells.

            kandi-Security Security

              amazon-k8s-node-drainer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              amazon-k8s-node-drainer code analysis shows 0 unresolved vulnerabilities.
              There are 9 security hotspots that need review.

            kandi-License License

              amazon-k8s-node-drainer has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              amazon-k8s-node-drainer releases are not available. You will need to build from source code and install.
              amazon-k8s-node-drainer has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              amazon-k8s-node-drainer saves you 288 person hours of effort in developing the same functionality from scratch.
              It has 776 lines of code, 47 functions and 9 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed amazon-k8s-node-drainer and discovered the below as its top functions. This is intended to give you an instant insight into amazon-k8s-node-drainer implemented functionality, and help decide if they suit your requirements.
            • Handler for Lambda function .
            • Obtain a Bearer token .
            • Create kube config file .
            • Evicts pods in the given pods .
            • Cancels a node .
            • Determine if a pod is evicts
            • Wait until all pods are empty .
            • Aborts a lifecycle action .
            • Remove all pods from the given node .
            • Wait for pods to finish .
            Get all kandi verified functions for this library.

            amazon-k8s-node-drainer Key Features

            No Key Features are available at this moment for amazon-k8s-node-drainer.

            amazon-k8s-node-drainer Examples and Code Snippets

            No Code Snippets are available at this moment for amazon-k8s-node-drainer.

            Community Discussions

            QUESTION

            AngularJS - move repeating functions from controller to service
            Asked 2021-Jul-28 at 16:14

            Hi I'm pretty new at angular JS and i'm trying to refactor my controller and want to move repeating multisort function as a service and call it back in the controller.

            Can someone help me in converting this below function as a service as it has all $scope and I know it can't be used in the service or factory:

            ...

            ANSWER

            Answered 2021-Jul-28 at 07:19

            If you dont want to change the code, you can directly pass $scope to the service and get as scope.

            Below is an working example, simplified on your requirement.

            Source https://stackoverflow.com/questions/68555795

            QUESTION

            Start container instance on web request to FQDN
            Asked 2020-Dec-17 at 23:09

            Let's say we have a (containerized) backend which is only sparely used. Maybe once every couple of days or so, a (static) web front-end calls an API endpoint of that backend.

            The backend conveniently happens to be stateless. No data store or anything.

            We want to minimize the hosting cost for it, and ideally would like per-second billing. It's only gonna be running for a few minutes every month, and we only want to be charged for that usage. Basically, we want Function as a Service (FaaS), but for a whole backend and not just a single function.

            Azure Container Instances appears to be great fit for this scenario. It can spin up the backend in a container when needed. The backend then can shut itself down again after a certain period of non-usage.

            So, let's create a container instance...

            ...

            ANSWER

            Answered 2020-Dec-17 at 20:36

            Azure Container Instances don't have a wehbook or HTTP trigger that will start them. However, you could use an Azure Function or Logic App that would effectively run az container start for you and then call THAT with HTTP. With either of those approaches, you'd have to setup some IAM permissions to give the Function or Logic App permissions to the ACI resource to start it.

            One approach would be to:

            1. Create an Azure Function with an HTTP trigger and a managed identity
            2. Give the Managed identity contributor access to ACI container group
            3. Run az container start or the equivalent REST call inside the function to start the ACI container
            4. Call the Azure function (using the function token) to start the container.

            Source https://stackoverflow.com/questions/65342897

            QUESTION

            write angular js service to access multiple function
            Asked 2020-Mar-19 at 10:04

            I am using below function to loadbenefittypes.

            my get data function

            ...

            ANSWER

            Answered 2020-Mar-19 at 10:04

            To re-factor the code to a service, return the $http promise:

            Source https://stackoverflow.com/questions/60750057

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install amazon-k8s-node-drainer

            You can download it from GitHub.
            You can use amazon-k8s-node-drainer like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/aws-samples/amazon-k8s-node-drainer.git

          • CLI

            gh repo clone aws-samples/amazon-k8s-node-drainer

          • sshUrl

            git@github.com:aws-samples/amazon-k8s-node-drainer.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Function As A Service Libraries

            faas

            by openfaas

            fission

            by fission

            fn

            by fnproject

            cli

            by acode

            lib

            by stdlib

            Try Top Libraries by aws-samples

            aws-cdk-examples

            by aws-samplesPython

            aws-serverless-workshops

            by aws-samplesJavaScript

            aws-workshop-for-kubernetes

            by aws-samplesShell

            aws-serverless-airline-booking

            by aws-samplesJavaScript