Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`kubectl` ignores non-existing config file pointed by the `KUBECONFIG` environment variable #77826

Open
vkhromov opened this issue May 13, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@vkhromov
Copy link

commented May 13, 2019

What happened:

$ ls -l zzz
ls: zzz: No such file or directory
$ KUBECONFIG=zzz kubectl get all
The connection to the server localhost:8080 was refused - did you specify the right host or port?

What you expected to happen:

$ KUBECONFIG=zzz kubectl get all
Error: configuration file `zzz' doesn't exist

How to reproduce it (as minimally and precisely as possible):

$ rm -f zzz
$ KUBECONFIG=zzz kubectl get all

Anything else we need to know?:
None

Environment:

  • Kubernetes version (use kubectl version):
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-19T22:12:47Z", GoVersion:"go1.12.4", Compiler:"gc", Platform:"darwin/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
$ uname -mrsv
Darwin 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
  • Kernel (e.g. uname -a):
$ uname -mrsv
Darwin 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
  • Install tools:
$ brew info kubernetes-cli
kubernetes-cli: stable 1.14.1 (bottled), HEAD
Kubernetes command-line interface
https://kubernetes.io/
/usr/local/Cellar/kubernetes-cli/1.14.1 (220 files, 47.9MB) *
  Poured from bottle on 2019-04-30 at 13:27:18
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/kubernetes-cli.rb
==> Dependencies
Build: go ✘
==> Options
--HEAD
	Install HEAD version
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Analytics
install: 49,789 (30 days), 158,500 (90 days), 596,280 (365 days)
install_on_request: 37,250 (30 days), 120,798 (90 days), 463,032 (365 days)
build_error: 0 (30 days)
  • Network plugin and version (if this is a network-related bug):
    None
  • Others:
    None
@vkhromov

This comment has been minimized.

Copy link
Author

commented May 13, 2019

/sig cli

@k8s-ci-robot k8s-ci-robot added sig/cli and removed needs-sig labels May 13, 2019

@nagexiucai

This comment has been minimized.

Copy link

commented May 14, 2019

v1.10.0 too.

@vkhromov

This comment has been minimized.

Copy link
Author

commented May 14, 2019

kubectl works as expected and prints the error if you specify the path to a non-existing kubeconfig file via the --kubeconfig= option:

$ kubectl --kubeconfig=zzz get all
error: stat zzz: no such file or directory
@hpandeycodeit

This comment has been minimized.

Copy link
Member

commented May 14, 2019

/priority backlog

@hpandeycodeit

This comment has been minimized.

Copy link
Member

commented May 14, 2019

@vkhromov Thanks for reporting it!
We should change the error message in this case as pointed by you.

@hpandeycodeit

This comment has been minimized.

Copy link
Member

commented May 15, 2019

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.