<p>While using this command for RBAC <code>&quot;kubectl config set-cluster test --server=https://127.0.0.1:52807&quot;</code>  the IP here is from the kind-cluster that I am running after which I use <code>&quot;kubectl config set-context test --cluster=test&quot;</code> followed by required credentials &amp; switch to the context by <code>&quot;kubectl config use-context test&quot;</code> and I am in the test context but with the first command  I am configuring the config file I got that but m I making a cluster within a cluster what you guys understand please help me clear my doubt what is it actually doing?</p>

Sijoy S Samuel
<p><code>kubectl config set-cluster</code> sets a cluster entry in your <code>kubeconfig</code> file (usually found in <code>$HOME/.kube/config</code>). The <code>kubeconfig</code> file defines how your <code>kubectl</code> is configured.</p>
<p>The cluster entry defines where <code>kubectl</code> can find the kubernetes cluster to talk to. You can have multiple clusters defined in your <code>kubeconfig</code> file.</p>
<p><code>kubectl config set-context</code> sets a context element, which is used to combine a cluster, namespace and user into a single element so that <code>kubectl</code> has everything it needs to communicate with the cluster. You can have multiple contexts, for example one per kubernetes cluster that you're managing.</p>
<p><code>kubectl config use-context</code> sets your current context to be used in <code>kubectl</code>.</p>
<p>So to walk through your commands:</p>
<ul>
<li><code>kubectl config set-cluster test --server=https://127.0.0.1:52807</code> creates a new entry in <code>kubeconfig</code> under the <code>clusters</code> section with a cluster called <code>test</code> pointing towards <code>https://127.0.0.1:52807</code></li>
<li><code>kubectl config set-context test --cluster=test</code> creates a new context in <code>kubeconfig</code> called <code>test</code> and tells that context to point to a cluster called <code>test</code></li>
<li><code>kubectl config use-context test</code> changes the the current context in <code>kubeconfig</code> to a context called <code>test</code> (which you just created).</li>
</ul>
<p>More docs on <code>kubectl config</code> and <code>kubeconfig</code>:</p>
<ul>
<li><a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/</a></li>
<li><a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-context-and-configuration" rel="noreferrer">https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-context-and-configuration</a></li>
</ul>
