k8s-bluegreen

command module
v0.0.0-...-14a32fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 16 Imported by: 0

README

Kubernetes Blue Green Deploy

Github Actions Go Report Card GoDoc License

A blue/green deploy implementation with pure Kubernetes. This will atomically update a deployment image using a service and its labels.

The deploy steps will consist in:

  1. Gets the service received as a parameter;
  2. Gets the deployment the service is selecting;
  3. Creates a new deployment, exactly as the old one, but with the new image and an opposite blue/green suffix (if the current deployment has no blue/green suffix, the next one will be blue);
  4. Points the service to the new deployment;
  5. Scales old deployment down to 0 replicas.

Installation

go get -u github.com/guilhermehubner/k8s-bluegreen

Credentials

You can connect to the cluster with a config file (-f .kube/config) or using environment variables. For example:

export KUBERNETES_SERVER=https://1.2.3.4:1234
export KUBERNETES_CERT=$(cat ca.cert)
export KUBERNETES_TOKEN=eyJhcGciDiJS...

Usage

Deploy
k8s-bluegreen deploy [OPTIONS]

OPTIONS:
   --config-file value, -f value  the kubernetes config file path (default: "~/.kube/config")
   --service value, -s value      the service name
   --image value, -i value        the new image for deployment
   --container value, -c value    the name of container in deployment
   --namespace value, -n value    the kubernetes namespace (default: "default")
   --help, -h                     show help (default: false)
Rollback
k8s-bluegreen rollback [OPTIONS]

OPTIONS:
   --config-file value, -f value  the kubernetes config file path (default: "~/.kube/config")
   --service value, -s value      the service name
   --namespace value, -n value    the kubernetes namespace (default: "default")
   --help, -h                     show help (default: false)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL