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

kubeadm token list - failed to load admin kubeconfig #303

Closed
gtirloni opened this issue Jun 14, 2017 · 2 comments
Closed

kubeadm token list - failed to load admin kubeconfig #303

gtirloni opened this issue Jun 14, 2017 · 2 comments

Comments

@gtirloni
Copy link

BUG REPORT

Versions

kubeadm version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:33:17Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

Kubernetes version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:44:27Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

OS: CentOS 7

Kernel: Linux host 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

What happened?

Listing tokens before kubeadm init has run returns an error on a fresh installed host:

What you expected to happen?

Token that was just created is listed.

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

# kubeadm token generate
d7f327.349dc72bd09f440b

# kubeadm token list
failed to load admin kubeconfig [open /etc/kubernetes/admin.conf: no such file or directory]

Anything else we need to know?

Issue happens on a fresh installed VM as well as after running kubeadm reset

@pipejakob
Copy link
Contributor

Our documentation and error messages could definitely be improved, but this is the expected behavior.

kubeadm token generate just generates a random token and prints it out, but doesn't attempt to persist it anywhere. It is stateless, and can be run at any point in time (even before kubeadm init). kubeadm token create is likely the functionality you're looking for, but it's meant to be used after you finish kubeadm init, because it creates a token and persists it within Kubernetes. When you run kubeadm token list, the failure you see is because it's trying to connect to the API server to fetch known tokens, but you haven't run kubeadm init to start the API server yet.

@gtirloni
Copy link
Author

Thanks, that makes sense. I somehow assumed it was decoupled from the unit phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants