Skip to content

Instantly share code, notes, and snippets.

@ws2356
Created May 7, 2019 09:57
Show Gist options
  • Save ws2356/b0003a9a84b8a2e7aa4481772011c3bd to your computer and use it in GitHub Desktop.
Save ws2356/b0003a9a84b8a2e7aa4481772011c3bd to your computer and use it in GitHub Desktop.
拷贝文件到多个匹配的pod的对应位置
#!/usr/bin/env bash
set -e
ff=$1
pat=${2:-apollon-backend}
di=$(dirname $ff)
function kube {
kubectl --kubeconfig=$HOME/Downloads/wansong.kubeconfig -n c-dev "$@"
}
pods=$(kube get po | grep -E $pat | awk '{ print $1 }')
for po in $pods ; do
kube cp "$ff" "${po}:$di"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment