Duplicating deployment

Overview

In case when deployment is already scaled at maximum reasonable amount of pods and we still have high traffic we might need to create duplicate of specific deployment to ease the problem temporarily.

This can be achieved by running deployment.js script which will create duplicate of specified deployment. Script is located here in me-toolsmith.

How to run the script

Prerequisite node v7+ installed on your machine.

  • First argument is deployment name you want to copy.

  • Second argument is environment, if left empty will default to staging. Script will automatically switch you to provided context.

  • Third argument is suffix you want to append to deployment name. If left empty will default to copy.

If you want to have custom suffix name second argument should also be passed.
Example
node deployment.js me-delivery-google-batch-default
Example production
node deployment.js me-delivery-google-batch-default production
Example with custom suffix name
node deployment.js me-delivery-google-batch-default staging duplicate2

Output

If everything is done correctly script will output one command you can run to check difference between copy and original deployment. And another command to add deployment to correct namespace.

Example output
Check diff between original and generated deployment with

            git diff --no-index /tmp/original.json /tmp/duplicate.json
To create new deployment execute command

            kubectl apply -f /tmp/duplicate.json -n mobile-engage