Skip to content

Instantly share code, notes, and snippets.

@adewaleafolabi
Last active August 24, 2020 02:21
Show Gist options
  • Save adewaleafolabi/c4d35fa4ff68c44c507f46cdbf0433f1 to your computer and use it in GitHub Desktop.
Save adewaleafolabi/c4d35fa4ff68c44c507f46cdbf0433f1 to your computer and use it in GitHub Desktop.
Kubectl Cheatsheet

Copy kubernetes secrets from Cluster1 to Cluster2 stripping out Cluster1 specific details. This also requires a file containing namespaces

while read F; do  kubectl get secret secret-name -o yaml -n $F --context=cluster-1 > $F.yaml && yaml_cli -f $F.yaml -d metadata:annotations:kubectl.kubernetes.io/last-applied-configuration -d metadata:creationTimestamp -d metadata:resourceVersion -d metadata:selfLink -d metadata:uid  && kubectl apply -f $F.yaml -n $F  --context=cluster-2; done < ns.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment