<p>it seems you’re trying to change the config by setting a context and you’re not providing the config to the change context command. So do this</p>
<pre><code>kubectl config --kubeconfig=infra_k8/config.yaml use-context test-sim
</code></pre>
<p>The setters are used when you want to add more entries to the config file, so you don’t need that command when changing context.</p>

CC BY-SA 4.0
2020-08-30T05:50:15.330Z
2020-08-30T05:55:21.587Z
2020-08-30T05:55:21.587Z
Edward Romero
<p>I have a kubernetes Config file such as:</p>
<pre><code>apiVersion: v1
kind: Config
preferences: {}
contexts:
- context:
    cluster: test-sim-development
    namespace: test-sim
    user: developer
  name: test-sim
</code></pre>
<p>When I issue a command such as:</p>
<pre><code>kubectl config --kubeconfig infra_k8/config.yaml set-context test-sim &amp;&amp; kubectl config use-context test-sim
</code></pre>
<p>I get back the following error output:</p>
<pre><code>Context &quot;test-sim&quot; modified.
error: no context exists with the name: &quot;test-sim&quot;
</code></pre>
<p>Why is it not finding the &quot;test-sim&quot; name? It is clearly referenced according to the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/" rel="nofollow noreferrer">kubernetes docs.</a></p>

<kubernetes><kubectl>
config.yaml is not setting up a new context
Nona
# config.yaml is not setting up a new context

(Asked by: username_0 on 2020-08-30)

I have a kubernetes Config file such as:
apiVersion: v1
kind: Config
preferences: {}
contexts:
- context:
    cluster: test-sim-development
    namespace: test-sim
    user: developer
  name: test-sim

When I issue a command such as:
kubectl config --kubeconfig infra_k8/config.yaml set-context test-sim && kubectl config use-context test-sim

I get back the following error output:
Context "test-sim" modified.
error: no context exists with the name: "test-sim"

Why is it not finding the "test-sim" name? It is clearly referenced according to the kubernetes docs.

**Tags:** kubernetes, kubectl


---

## 1 answers

### Answer by username_1 on 2020-08-30. Score: 1

it seems you’re trying to change the config by setting a context and you’re not providing the config to the change context command. So do this
kubectl config --kubeconfig=infra_k8/config.yaml use-context test-sim

The setters are used when you want to add more entries to the config file, so you don’t need that command when changing context.


---

