<p>I can't seem to figure out how to create a totally new Kubernetes cluster on a Docker Desktop running instance on my computer. (It shouldn't matter if this was a Mac or PC).</p>

<p>I know how to -set- the current cluster context, but I only have one cluster so I can't set anything else.</p>

<pre><code>### What's my current context pointing to?
$ kubectl config current-context
docker-for-desktop

### Set the context to be "docker-for-desktop" cluster
$ kubectl config use-context docker-for-desktop
Switched to context “docker-for-desktop”
</code></pre>

<p>Further questions:</p>

<ol>
<li>If I have multiple clusters, then only one of them (the currently 'set' one) will be running at once with the other's stopped/sleeping?</li>
<li>Clusters are independent from each other, so if i can muck around and play with one cluster, then this should not impact another cluster</li>
</ol>

Pure.Krome
<p>Kubernetes config file describes 3 objects: <strong>clusters</strong>, <strong>users</strong>, and <strong>contexts</strong>.</p>

<p><strong>cluster</strong> - cluster name + details - the host and the certificates.</p>

<p><strong>user</strong> - user name and credentials, to authorise you against any cluster host.</p>

<p>the <strong>context</strong> role is to make the connection between a <strong>user</strong> and a <strong>cluster</strong>, so when you use that context,<code>kubectl</code> will authorise you against the cluster specified in the context object, using the credentials of the user specified in the context object. an example <code>context</code> object:</p>

<pre><code>apiVersion: v1
current-context: ""
kind: Config
preferences: {}

clusters:
- cluster:
    certificate-authority: xxxxxxxxx
    server: xxxxxxxxx
  name: gke_dev-yufuyjfvk_us-central1-a_standard-cluster-1

users:
- name: efrat-dev
  user:
    client-certificate: xxxxxxxxx
    client-key: xxxxxxxxx

contexts:
- context:
    cluster: gke_dev-yufuyjfvk_us-central1-a_standard-cluster-1
    user: efrat-dev
  name: gke-dev
</code></pre>

<p>the <code>kubectl config</code> subcommand has a set of commands to <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="nofollow noreferrer">generate cluster, user &amp; context entries</a> in the config file.</p>

<p><strong>multiple k8s clusters from docker-desktop</strong></p>

<p>under the hood, when you enable k8s, docker desktop downloads kubernetes components as docker images, and the server listens <code>https://localhost:6443</code>. it is all done automatically so unless you have any intention to run the entire structure by yourself i dont suppose you can configure it to run multiple clusters.</p>

<p><strong>about your further questions:</strong></p>

<p>when you set a context, <code>kubectl</code> will set <code>current-context</code> to that one, and every <code>kubectl</code> you run will go to the context's cluster, using the context's user credentials. it doesnt mean the clusters are dead. it wont affect them at all.</p>
