Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@denniswebb
Created January 26, 2018 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denniswebb/a00cc8eabc79e60e97747488614af8bb to your computer and use it in GitHub Desktop.
Save denniswebb/a00cc8eabc79e60e97747488614af8bb to your computer and use it in GitHub Desktop.
Copy Kubernetes secret from 1 namespace to another
#!/usr/bin/env bash
SECRET_NAME=$1
SRC_NS=$2
DST_NS=$3
kubectl -n ${SRC_NS} get secret ${SECRET_NAME} -o yaml | sed "/resourceVersion/d" | sed "/creationTime/d" | sed "/selfLink/d" | sed "/uid/d" | sed "s/namespace: ${SRC_NS}/namespace: ${DST_NS}/g" | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment