Skip to content
Roll all instances within a kubernetes cluster, using a zero-downtime strategy.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci push images to gcr instead of docker hub Dec 12, 2018
bin push images to gcr instead of docker hub Dec 12, 2018
cloudprovider fix fetching instance by dns name Oct 10, 2018
cmd
controllers
examples remove watch frequency argument in loop example Jun 3, 2019
kubernetes make node eviction context less Dec 3, 2018
vendor setup the run command Oct 1, 2018
.gitignore compile and build docker images Oct 10, 2018
Dockerfile setup example manifest Oct 15, 2018
Gopkg.lock
Gopkg.toml setup the run command Oct 1, 2018
LICENSE
Makefile compile and build docker images Oct 10, 2018
README.md remove WIP Dec 12, 2018
main.go

README.md

Dice

Dice will roll all instances within a kubernetes cluster, using a zero-downtime strategy.

Whenever running the process, it will:

  • Flag all running instances as dice=roll. All those instances will be rolled.
  • Evict all pods from the number of parallel instances required.
  • Listen for all pods stopping on a node.
    • When a node has no pods anymore, it will delete it.
  • Listen for all new nodes arriving on the cluster.
    • When a new node comes up, it will move on to evicting the pods on another one.

Dice assumes the cluster has an auto-scaler running, so when a node is deleted, another one can be booted.

Supported Providers

Only AWS is currently supported

Usage

In Cluster

In order to run dice within the cluster, kubernetes needs to be able to delete AWS instances. That can be done with the following IAM policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ec2:TerminateInstances"
            ],
            "Resource": "*"
        }
    ]
}

As a one-off

Running dice as a one-off is a good use case when you have changed the boot configuration for your instances for examples, and you need new ones with the appropriate config.

kubeclt apply -f examples/dice-aws.yaml

Regularly roll instances

You may want to regularly roll instances if they are too old. This allows rolling out the fleet on a regular cadence.

kubeclt apply -f examples/loop-aws.yaml

Out of Cluster

You can run dice from your own machines (good for testing, but it shouldn't be used on production workloads).

go get -u github.com/dmathieu/dice
dice run -c aws

Note: you can run the permanent loop out of the cluster with the dice loop -c aws command. This is not recommended however, as you would then need to have the process running permanently.

You can’t perform that action at this time.