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 init --token is only respected if its the sole flag #325

Closed
namliz opened this issue Jun 28, 2017 · 7 comments
Closed

kubeadm init --token is only respected if its the sole flag #325

namliz opened this issue Jun 28, 2017 · 7 comments

Comments

@namliz
Copy link

namliz commented Jun 28, 2017

Is this a BUG REPORT or FEATURE REQUEST?

BUG REPORT

Versions

kubeadm version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Kubernetes version (use kubectl version):
    Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:34:20Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: aws
  • OS (e.g. from /etc/os-release): Centos7
  • Kernel (e.g. uname -a): Linux ip-172-20-0-211 3.10.0-514.21.2.el7.x86_64 kubeadm join on slave node fails preflight checks #1 SMP Tue Jun 20 12:24:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

What happened?

You can now join any number of machines by running the following on each node
as root:

  kubeadm join --token 80dde6.5ea0388857dfb1c3 172.20.0.211:6443

What you expected to happen?

You can now join any number of machines by running the following on each node
as root:

  kubeadm join --token thecustomtoken 172.20.0.211:6443

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

kubeadm init --token=${TOKEN} --config=/etc/kubernetes/kubeadm.conf

Anything else we need to know?

kubeadm init --token=${TOKEN} works as expected.

Anything else we need to know?

I'm not sure if this is by design or not. I believe I was able to use two flags with kubeadm init just a few days ago, so perhaps this is a regression with kubeadm 1.6.6.

@gtirloni
Copy link

Can you share you /etc/kubernetes/kubeadm.conf file?

@luxas
Copy link
Member

luxas commented Jun 30, 2017

This is working as expected and documented. --config has precedence over any flag.
I think we made v1.7 error out or warn if you combine them...

@luxas luxas closed this as completed Jun 30, 2017
@gtirloni
Copy link

@luxas I was able to reproduce this behavior with the following kubeadm.conf file:

apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
selfHosted: false

The token passed to kubeadm init --token was ignored and a new one generated, even though the config file is not specifying a token.

@namliz
Copy link
Author

namliz commented Jun 30, 2017

@gtirloni sure, it is the basic one.

kind: MasterConfiguration
apiVersion: kubeadm.k8s.io/v1alpha1
cloudProvider: aws

@luxas you're not wrong in that appending token: $TOKEN to the config file works as expected.
However, when there is no token in the config file the --token flag should be respected. I do believe there is a (non critical) bug here.

Please reopen.

@luxas
Copy link
Member

luxas commented Jun 30, 2017

However, when there is no token in the config file the --token flag should be respected. I do believe there is a (non critical) bug here.

That's a design decision.
What happens?

  1. There is an empty, defaulted, versioned struct object (cfg).
  2. Flags are applied upon that object cfg, and defaulted once again.
  3. cfg is converted to the internal version of the struct => internalcfg
  4. If config is specified, there is a decoder that marshals the yaml/json file into internalcfg
  5. Use internalcfg for all operations

@namliz
Copy link
Author

namliz commented Jun 30, 2017

@luxas I think if I'm getting it correctly is that the config file takes precedence. I agree with that as a design decision.

What I'm saying is that up until this latest version if you specified something like the token via a flag that did not exist in the config file, it would get picked up. That is both intuitive and documented. An example like that is given in the docs and was working last week.

If the change is now that if a config file is specified at all no other flag is respected, that's also fine, but then at least the documentation needs to reflect this.

@luxas
Copy link
Member

luxas commented Jun 30, 2017

What I'm saying is that up until this latest version if you specified something like the token via a flag that did not exist in the config file, it would get picked up. That is both intuitive and documented. An example like that is given in the docs and was working last week.

@Zilman Interesting. Which kubeadm version?

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

3 participants