config.yaml is not setting up a new context 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 &amp;&amp; kubectl config use-context test-sim

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

Why is it not finding the &quot;test-sim&quot; name? It is clearly referenced according to the kubernetes docs.
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.