<p>Docker Desktop for Windows and macOS come with the <code>docker-desktop</code> cluster. I'm trying to figure out how to either copy it, or make a new cluster based on it as a template. I like to have clusters for each project I'm working on so that things like PVC, PV and secrets are isolated, and I can just switch between them with <code>kubectl config use-context project1</code>. I've been looking through documentation and Google search results and haven't identified how to do this, or if it is possible. Any suggestions?</p>

cjones
<p>If there's a set of resources that you want to routinely deploy to new clusters, you can create a source-control repository that contains the YAML files you need.  Then when you have a new cluster you can <code>kubectl apply -f</code> your directory of bootstrap artifacts.  Using <a href="https://kind.sigs.k8s.io" rel="nofollow noreferrer">kind</a>, for example:</p>
<pre class="lang-sh prettyprint-override"><code>kind create cluster --name dev2
kubectl apply -f ./bootstrap/
...
kind delete cluster --name dev2
</code></pre>
<p>If you need to configure or parameterize this setup in some way, packaging it as a <a href="https://helm.sh" rel="nofollow noreferrer">Helm</a> chart can make sense.</p>
<p>This approach also means avoiding the imperative-style <code>kubectl create</code>, <code>kubectl run</code>, and <code>kubectl expose</code> type commands.  Create the YAML files you need, check them in, and use <code>kubectl apply</code> to install them.</p>
<p>It can be a little tricky to usefully export a cluster, and this isn't something that's commonly done.  For example, if you have a Pod, was it created by a Deployment or directly through a YAML file?  Was that PersistentVolume hand-created, or did a provisioner create it, and are its settings specific to a particular Kubernetes environment?  Working from a reproducible source-controlled tree avoids these issues.</p>
