Skip to content

Instantly share code, notes, and snippets.

@marciorodrigues87
Created June 29, 2018 18:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marciorodrigues87/c034c6597db6686f49e00ede34aaddb2 to your computer and use it in GitHub Desktop.
Save marciorodrigues87/c034c6597db6686f49e00ede34aaddb2 to your computer and use it in GitHub Desktop.
REPLICAS_COUNT=$(kubectl -s $K8S_CLUSTER --token=$K8S_TOKEN -n $NAMESPACE get pods -l app=$YOUR_APP | grep -i running | wc -l | grep -oE "[0-9]+")
if [ $REPLICAS_COUNT -eq 0 ]; then
REPLICAS_COUNT=2
fi
REPLICAS_COUNT=$REPLICAS_COUNT envsubst < deploy/your-deployment.yaml.template > your-deployment.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment