#!/bin/bash # https://serverfault.com/a/887402 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 -- "$@"