Skip to content

Instantly share code, notes, and snippets.

@ET-Chan
Created June 23, 2020 17:07
Show Gist options
  • Save ET-Chan/5fe1bd0090ffbfd82ac979fc0bdeb6a3 to your computer and use it in GitHub Desktop.
Save ET-Chan/5fe1bd0090ffbfd82ac979fc0bdeb6a3 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$KRSYNC_STARTED" ]; then
export KRSYNC_STARTED=true
exec rsync --blocking-io --rsh "$0" $@
fi
# Running as --rsh
namespace=''
pod=$1
shift
# If use uses pod@namespace rsync passes as: {us} -l pod namespace ...
if [ "X$pod" = "X-l" ]; then
pod=$1
shift
namespace="-n $1"
shift
fi
exec kubectl $namespace exec -i $pod -- "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment