Giter VIP home page Giter VIP logo

upgrade-manager's Introduction

RollingUpgrade

Build Status Build Status codecov

Reliable, extensible rolling-upgrades of Autoscaling groups in Kubernetes

RollingUpgrade provides a Kubernetes native mechanism for doing rolling-updates of instances in an AutoScaling group using a CRD and a controller.

What does it do?

  • RollingUpgrade is highly inspired by the way kops does rolling-updates.

  • It provides similar options for the rolling-updates as kops and more.

  • The RollingUpgrade Kubernetes custom resource has the following options in the spec:

    • asgName: Name of the autoscaling group to perform the rolling-update.
    • preDrain.script: The script to run before draining a node.
    • postDrain.script: The script to run after draining a node. This allows for performing actions such as quiescing network traffic, adding labels, etc.
    • postDrain.waitSeconds: The seconds to wait after a node is drained.
    • postDrain.postWaitScript: The script to run after the node is drained and the waitSeconds have passed. This can be used for ensuring that the drained pods actually were able to start elsewhere.
    • nodeIntervalSeconds: The amount of time in seconds to wait after each node in the ASG is terminated.
    • postTerminate.script: Optional bash script to execute after the node has terminated.
    • strategy.mode: This field is optional and allows for two possible modes
      • lazy - this is the default mode, upgrade will terminate an instance first.
      • eager - upgrade will launch an instance prior to terminating.
    • strategy.type: This field is optional and currently two strategies are supported
      • randomUpdate - Default is type is not specified. Picks nodes randomly for updating. Refer to random_update_strategy.yaml for sample custom resource definition.
      • uniformAcrossAzUpdate - Picks same number of nodes or same percentage of nodes from each AZ for update. Refer to uniform_across_az_update_strategy.yaml for sample custom resource definition.
    • strategy.maxUnavailable: Optional field. The number of nodes that can be unavailable during rolling upgrade, can be specified as number of nodes or the percent of total number of nodes. Default is "1".
    • strategy.drainTimeout: Optional field. Node will be terminated after drain timeout even if kubectl drain has not been completed and value has to be specified in seconds. Default is -1.
  • After performing the rolling-update of the nodes in the ASG, RollingUpgrade puts the following data in the "Status" field.

    • currentStatus: Whether the rolling-update completed or errored out.
    • startTime: The RFC3339 timestamp when the rolling-update began. E.g. 2019-01-15T23:51:10Z
    • endTime: The RFC3339 timestamp when the rolling-update completed. E.g. 2019-01-15T00:35:10Z
    • nodesProcessed: The number of ec2 instances that were processed.
    • conditions: Conditions describing the lifecycle of the rolling-update.

Design

For each RollingUpgrade custom resource that is submitted, the following flowchart shows the sequence of actions taken to perform the rolling-update

Dependencies

  • Kubernetes cluster on AWS with nodes in AutoscalingGroups. rolling-upgrades have been tested with Kubernetes clusters v1.12+.
  • An IAM role with at least the policy specified below. The upgrade-manager should be run with that IAM role.

Installing

Complete step by step guide to create a cluster and run rolling-upgrades

For a complete, step by step guide for creating a cluster with kops, editing it and then running rolling-upgrades, please see this

Existing cluster in AWS

If you already have an existing cluster created using kops, follow the instructions below.

  • Ensure that you have a Kubernetes cluster on AWS.

  • Install the CRD using: kubectl apply -f https://raw.githubusercontent.com/keikoproj/upgrade-manager/master/config/crd/bases/upgrademgr.keikoproj.io_rollingupgrades.yaml

  • Install the controller using: kubectl create -f https://raw.githubusercontent.com/keikoproj/upgrade-manager/master/deploy/rolling-upgrade-controller-deploy.yaml

  • Note that the rolling-upgrade controller requires an IAM role with the following policy

{
    "Effect": "Allow",
    "Action": [
        "ec2:CreateTags",
        "ec2:DescribeInstances",
        "autoscaling:EnterStandby",
        "autoscaling:DescribeAutoScalingGroups",
        "autoscaling:TerminateInstanceInAutoScalingGroup"
    ],
    "Resource": [
        "*"
    ]
}
  • If the rolling-upgrade controller is directly using the IAM role of the node it runs on, the above policy will have to be added to the IAM role of the node.
  • If the rolling-upgrade controller is using it's own role created using KIAM, that role should have the above policy in it.

For more details and FAQs, refer to this

upgrade-manager's People

Contributors

adammw avatar almonteb avatar davemasselink avatar deepakbenny avatar eytan-avisror avatar formuzi avatar garomonegro avatar grosser avatar johandry avatar kianjones4 avatar narayanan avatar sahilbadla avatar sbadla1 avatar shaoxt avatar shreyas-badiger avatar shrinandj avatar sivathiru1 avatar tekenstam avatar uthark avatar vgunapati avatar vigith avatar zhatt 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.