Coder Social home page Coder Social logo

luciferinlove / aws-k8s-ebs-autoscaler Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 38 KB

Enlarges the size of AWS EBS volumes directly or as Kubernetes PVC.

License: Apache License 2.0

Dockerfile 0.36% Go 99.64%
golang go aws ebs ebs-volumes ebs-snapshots kubernetes pvc

aws-k8s-ebs-autoscaler's Introduction

Go Report Card Build status

aws-k8s-ebs-autoscaler

Enlarges the size of AWS EBS volumes directly or as Kubernetes PVC. It can be used in pair with alertmanager-webhook-receiver. You can see a sample of usage in the How it works section below.

NOTE: This is an alpha version, you shouldn't use it in a production environment.

NOTE: Any value of the percents flag causes the size to increase to 1 Gb minimum. For example, if the size of the EBS volume is 5 Gb and the percents is less than 35, the EBS volume size will be increased to 1 Gb.

Usage

Usage of aws-k8s-ebs-autoscaler:
  -dry-run
        If true, only show the result without enlarging the volume. (default false)
  -k8s-snapshot-class string
        The name of the VolumeSnapshotClass resource, which is used to create snapshots in Kubernetes. (default "csi-aws-vsc")
  -log-level string
        Only log messages with the given severity or above. One of: [debug, info, warn, error] (default "info")
  -mount-point string
        Mount point of the volume to be enlarged. (required if pvc isn't set)
  -percents int
        By what percentage to increase. (default 20)
  -proc-path string
        procfs mountpoint. (default "/proc")
  -pvc string
        PVC ID of the volume to be enlarged. (required if mount-point isn't set)
  -pvc-namespace string
        Kubernetes namespace where pvc is located. (required if mount-point isn't set)
  -snapshot
        If true, create a volume snapshot. (default false)
  -sys-path string
        sysfs mountpoint. (default "/sys")
  -wait-for-modifying
        If true, wait for enlarging the volume to be completed. (default false)

aws-k8s-ebs-autoscaler reads namespace from /var/run/secrets/kubernetes.io/serviceaccount/namespace if namespaces aren't defined in command line flags. It also reads Kubernetes Service Account Token from /var/run/secrets/kubernetes.io/serviceaccount/token.

How it works

aws-k8s-ebs-autoscaler was created to run mainly as Kubernetes Job in pair with alertmanager-webhook-receiver. alertmanager-webhook-receiver responds to monitoring events and triggers Kubernetes Jobs with labels as parameters. For example, the event of insufficient disk space appears as an alert in the alertmanager. Alertmanager sends webhook to alertmanager-webhook-receiver. alertmanager-webhook-receiver takes the mount point or PVC from the labels and runs aws-k8s-ebs-autoscaler as Kubernetes Job.

Note that false and multiple consecutive alerts are the responsibility of the monitoring system, not of the alertmanager-webhook-receiver or aws-k8s-ebs-autoscaler.

aws-k8s-ebs-autoscaler performs actions depending on what was passed as an argument, mount-point or pvc.

If mount-point is received in arguments

NOTE: Linux file system won't automatically extend after the volume enlargement. You could run aws-k8s-ebs-autoscaler as an init container and then run a container with utilities to extend the Linux file system, but it's better to use external tools for security reasons. Or you can use such tools as embiggen-disk. Read this doc.

  • aws-k8s-ebs-autoscaler searches for volume serial number by the mount point. In the case of EBS the serial number is EBS VolumeID.
  • If the snapshot flag was provided as true, it creates an EBS volume snapshot.
  • If the dry-run flag was provided as true, aws-k8s-ebs-autoscaler only shows information about enlarging.
  • If not, it enlarges the EBS volume by a percentage, defined in the percents flag.
  • If the wait-for-modifying flag was provided as true, aws-k8s-ebs-autoscaler waits for the in-use status of the EBS volume.

If pvc is received in arguments

NOTE: The allowVolumeExpansion and ExpandInUsePersistentVolumes options should be enabled in your Kubernetes cluster for the PVC auto enlarging. Read this doc.

  • aws-k8s-ebs-autoscaler gets the PVC metadata in the given Kubernetes namespace provided in the pvc-namespace flag.
  • If the snapshot flag was provided as true, it creates a Kubernetes VolumeSnapshot resource. Note about the k8s-snapshot-class flag.
  • If the dry-run flag was provided as true, aws-k8s-ebs-autoscaler only shows information about enlarging.
  • If not, it enlarges the PVC size.
  • If the wait-for-modifying flag was provided as true, aws-k8s-ebs-autoscaler waits for the Ready status of the PVC.

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.