Skip to content

Instantly share code, notes, and snippets.

@markhilton
Created October 21, 2018 23:05
Show Gist options
  • Save markhilton/9626b2c132f8f92e59a10574eac1fd7c to your computer and use it in GitHub Desktop.
Save markhilton/9626b2c132f8f92e59a10574eac1fd7c to your computer and use it in GitHub Desktop.
Kubernetes force rolling update on deployment. Usage: k8roll [required: deployment name] [optional: namespace]
#!/bin/bash
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -ge 1 ] || die "ERROR: deployment name argument is required, $# provided"
NAMESPACE=${2:-default}
kubectl -n $NAMESPACE patch deployment $1 -p \
"{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment