Created
November 1, 2021 16:03
-
-
Save rdemorais/47a6de016fa454c673a4bf96be034410 to your computer and use it in GitHub Desktop.
kubectl copy without cp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function copy_text_to_pod() { | |
namespace=$1 | |
pod_name=$2 | |
src_filename=$3 | |
dest_filename=$4 | |
base64_text=`cat $src_filename | base64` | |
kubectl --kubeconfig=conasems-config.yml exec -n $namespace $pod_name -- bash -c "echo \"$base64_text\" | base64 -d > $dest_filename" | |
} | |
copy_text_to_pod tools postgres-6444bd9b85-v7t62 municipios.csv /tmp/municipios.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment