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

writing kubeconfig: Error writing file : open : no such file or directory #4100

Closed
tstromberg opened this issue Apr 15, 2019 · 9 comments · Fixed by #5056
Closed

writing kubeconfig: Error writing file : open : no such file or directory #4100

tstromberg opened this issue Apr 15, 2019 · 9 comments · Fixed by #5056
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2

Comments

@tstromberg
Copy link
Contributor

@James-DC commented on Sat Apr 13 2019

This is a Bug Report

Problem:
Running minikube start as the setup guide suggests yields the following failure:

james@james-desktop:~$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.10
DISTRIB_CODENAME=cosmic
DISTRIB_DESCRIPTION="Ubuntu 18.10"
NAME="Ubuntu"
VERSION="18.10 (Cosmic Cuttlefish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.10"
VERSION_ID="18.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=cosmic
UBUNTU_CODENAME=cosmic
james@james-desktop:~$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
>   && chmod +x minikube
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38.2M  100 38.2M    0     0  6992k      0  0:00:05  0:00:05 --:--:-- 7456k
james@james-desktop:~$ sudo cp minikube /usr/local/bin && rm minikube
james@james-desktop:~$ minikube start
😄  minikube v1.0.0 on linux (amd64)
🤹  Downloading Kubernetes v1.14.0 images in the background ...
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
🔥  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
💿  Downloading Minikube ISO ...
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
2019/04/13 20:05:33 No matching credentials were found, falling back on anonymous
 142.88 MB / 142.88 MB [============================================] 100.00% 0s
📶  "minikube" IP address is 192.168.99.105
🐳  Configuring Docker as the container runtime ...
🐳  Version of container runtime is 18.06.2-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
💾  Downloading kubeadm v1.14.0
💾  Downloading kubelet v1.14.0

💣  Failed to setup kubeconfig: writing kubeconfig: Error writing file : open : no such file or directory

😿  Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
👉  https://github.com/kubernetes/minikube/issues/new

I found running sudo minikube start lets minikube start successfully:

james@james-desktop:~$ sudo minikube start
😄  minikube v1.0.0 on linux (amd64)
🤹  Downloading Kubernetes v1.14.0 images in the background ...
🔥  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶  "minikube" IP address is 192.168.99.107
🐳  Configuring Docker as the container runtime ...
🐳  Version of container runtime is 18.06.2-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
🚜  Pulling images required by Kubernetes v1.14.0 ...
🚀  Launching Kubernetes v1.14.0 using kubeadm ... 
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑  Configuring cluster permissions ...
🤔  Verifying component health .....
💗  kubectl is now configured to use "minikube"
💡  For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/
🏄  Done! Thank you for using minikube!

However any further interaction with minikube / kubectl also requires the use of sudo to function properly which is not desirable.

Page to Update:
https://kubernetes.io/docs/tasks/tools/install-minikube/

@afbjorklund
Copy link
Collaborator

The error indicates that the filename was "":

		return errors.Wrapf(err, "Error writing file %s", filename)

@tuptaker
Copy link

I'm having the same issue. Which file is this referring to and how is it set? Is it ~/.kube/config?

@tuptaker
Copy link

tuptaker commented Apr 20, 2019

So, I had KUBECONFIG set to a list of configs for various clusters I was working with. Apparently, this was prohibiting Minikube from starting. To resolve, I unset KUBECONFIG before starting minikube.

unset KUBECONFIG
minikube start

When you're done using minikube and have stopped it, you can source your .bashrc or .bash_profile (wherever KUBECONFIG is defined) or restart your terminal and resume working with the other clusters.

Hope this helps someone.

@tstromberg tstromberg changed the title Issue with k8s.io/docs/tasks/tools/install-minikube/ writing kubeconfig: Error writing file : open : no such file or directory Apr 22, 2019
@tstromberg tstromberg added kind/bug Categorizes issue or PR as related to a bug. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Apr 22, 2019
@tstromberg tstromberg added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2 and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels May 23, 2019
@den-is
Copy link

den-is commented Aug 6, 2019

same here with minikube 1.3.0 on macos 10.14.6

minikube start --v=3
😄  minikube v1.3.0 on Darwin 10.14.6
💡  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
🏃  Using the running virtualbox "minikube" VM ...
⌛  Waiting for the host to be provisioned ...
Waiting for SSH to be available...
Detecting the provisioner...
Setting Docker configuration on the remote daemon...
🐳  Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...

💣  Failed to setup kubeconfig: writing kubeconfig: Error writing file : open : no such file or directory

😿  Sorry that minikube crashed.

@tstromberg
Copy link
Contributor Author

tstromberg commented Aug 6, 2019

@den-is Can you share the output of env | grep KUBECONFIG?

It seems possible that you have KUBECONFIG set to an invalid location in your environment. Alternatively, please share the output of:

minikube start --alsologtostderr -v=4

Thanks!

@medyagh
Copy link
Member

medyagh commented Aug 6, 2019

I am curious why your customse kubeconfig was not usable by minikube ! if this is the case ! minikube shouldn't have cared ! if it doest, we need to detect and let user know by a solution message.

@den-is
Copy link

den-is commented Aug 6, 2019

@tstromberg and I think that is pointed to right location

env | grep -i kube
KUBECONFIG=:/Users/den/.kube/config:/Users/den/.kube/config

I'm not sure why there is duplicate, but imagine it doesn't exist there, and there are many other "concatenated" kubeconfigs for different clusters

@carlossg
Copy link
Contributor

I had the same issue, the problem is the initial : in KUBECONFIG

KUBECONFIG=:/Users/den/.kube/config:/Users/den/.kube/config

should be

KUBECONFIG=/Users/den/.kube/config:/Users/den/.kube/config

Probably you have KUBECONFIG=$KUBECONFIG:/Users/den/.kube/config in your ~/.bash_profile

Although the error message could be clearer

@den-is
Copy link

den-is commented Aug 13, 2019

@carlossg good point !

indeed I have export KUBECONFIG=$KUBECONFIG:$HOME/.kube/config

error message could be clearer and minikube can be smarter about empty strings too

carlossg added a commit to carlossg/minikube that referenced this issue Aug 13, 2019
Fixes kubernetes#4100

Signed-off-by: Carlos Sanchez <carlos@apache.org>
carlossg added a commit to carlossg/minikube that referenced this issue Aug 13, 2019
Signed-off-by: Carlos Sanchez <carlos@apache.org>
carlossg added a commit to carlossg/minikube that referenced this issue Aug 14, 2019
Signed-off-by: Carlos Sanchez <carlos@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants