<p>I am getting error  while copying the kubernetes secret from one namespace to another:</p>
<pre><code>kubectl get secret secret1 --namespace=test --export -o=yaml | kubectl apply --namespace=test1 -f -

Error: unknown flag: --export
See 'kubectl get --help' for usage.
error: no objects passed to apply
</code></pre>

cloudbud
<p><code>--export</code> option has been deprecated in version 1.14 and removed in version 1.18. If you are using kubernetes version 1.18 or above, you can try using below command (using sed) to copy secret from one namespace to other.</p>
<pre><code>kubectl get secret secret1 --namespace=test -o yaml | sed 's/namespace: test/namespace: test1/g' | kubectl create -f -  
</code></pre>
<p>Thanks,</p>
