Skip to content

Instantly share code, notes, and snippets.

@jcderr
Last active January 26, 2021 18:34
Show Gist options
  • Save jcderr/f9d9832ca3d12298a1387773000a457f to your computer and use it in GitHub Desktop.
Save jcderr/f9d9832ca3d12298a1387773000a457f to your computer and use it in GitHub Desktop.
Copy a Kubernetes Context
#!/bin/bash
FROM=$1
[[ -n "$FROM" ]] || exit 1
for ITEM in ns secrets configmaps rc deployments svc; do
for OBJ in $(kubectl --context=$FROM get $ITEM -o name); do
kubectl --context=$FROM get $OBJ -o yaml | kubectl create -f -
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment