I have a kubernetes Config file such as:

apiVersion: v1
kind: Config
preferences: {}
- 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.

1 Answer 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.