<p>How can I duplicate a namespace with all content with a new name in the same kubernetes cluster?</p>

<p>e.g. Duplicate default to my-namespace which will have the same content.</p>

<p>I'm interested just by services and deployments, so
when I try with method with kubectl get all and with api-resources i have error with services IP like :</p>

<pre><code>Error from server (Invalid): Service "my-service" is invalid: spec.clusterIP: Invalid value: "10.108.14.29": provided IP is already allocated
</code></pre>

<p>There is no specific way to do this. You could probably get close with something like <code>kubectl get all -n sourcens -o yaml | sed -e 's/namespace: sourcens/namespace:  destns/' | kubectl apply -f -</code> but <code>get all</code> is always a bit wonky and this could easily miss weird edge cases.</p>
