kops update cluster --yes: kops has set your kubectl context to NAME - ~/.kube/config updated/created

Created on 30 Jun 2018  路  5Comments  路  Source: kubernetes/kops

------------- BUG REPORT TEMPLATE --------------------

  1. What kops version are you running? The command kops version, will display
    this information.
$ kops version
Version 1.9.1 (git-ba77c9ca2)
  1. What Kubernetes version are you running? kubectl version will print the
    version if a cluster is running or provide the Kubernetes version specified as
    a kops flag.
kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:13:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-06T08:00:59Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
  1. What cloud provider are you using?

  1. What commands did you run? What is the simplest way to reproduce this issue?
kops update cluster --yes
  1. What happened after the commands executed?
  • Cluster updated
  • kubectl config file created/appended in ~/.kube/config
  1. What did you expect to happen?
  • Not mess with my existing ~/.kube/config file
  1. Please provide your cluster manifest. Execute
    kops get --name my.example.com -o yaml to display your cluster manifest.
    You may want to remove your cluster name and other sensitive information.

  2. Please run the commands with most verbose logging by adding the -v 10 flag.
    Paste the logs into this report, or in a gist and provide the gist link here.

  3. Anything else do we need to know?

------------- FEATURE REQUEST TEMPLATE --------------------

I don't want the command to create or append to my ~/.kube/configfile or at least tellkop` to use a different location.

Most helpful comment

Got it. Thanks

All 5 comments

$ kops update cluster --help
...
Flags:
      --create-kube-config                Will control automatically creating the kube config file on your local filesystem (default true)

@adamglt yes I already so this flag and it is turned on by default. So how do I negate this? The help is not very helpful in this case.

I guess it's not that clear if you haven't used cobra/viper (the CLI library used here) before, maybe I'm just used to it.

you can disable it with kops update cluster --create-kube-config=false <other flags>

Got it. Thanks

@cytopia I'm probably a little late here, but alternatively you can consider from https://github.com/kubernetes/kops/blob/master/docs/cli/kops_export_kubecfg.md:

Export a kubecfg file for a cluster from the state store. The configuration will be saved into a users $HOME/.kube/config file. To export the kubectl configuration to a specific file set the KUBECONFIG environment variable.

Then:

KUBECONFIG="~/.kube/config-cluster-name" kops update cluster \
    --name=k8s-cluster.example.com 
    --state=s3://kops-state-1234 --yes
    --create-kube-config=true \
Was this page helpful?
0 / 5 - 0 ratings