K8s Horizontal Autoscale Script

?
S
Bash

Autoscale script to automate/abstract kubectl command.

1#!/bin/sh
2if [ "$1" == "--replicas" ] & [ ! -z "$2" ] & [ "$3" == "--deployment" ] & [ ! -z "$4" ]
3then
4    echo "Replicas and Deployment received"
5    replicas=$2
6    deployment=$4
7
8    echo $deployment $replicas
9    kubectl scale --replicas=$replicas deployment $deployment
10else
11    echo "Please specify replicas and deployment. Example: '--replicas 5 --deployment my-deployment'"
12fi

Created on 8/13/2018