-
Notifications
You must be signed in to change notification settings - Fork 715
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 phase bootstrap-token ignores --kubeconfig in 1.29 #2992
Comments
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig cluster-lifecycle |
/transfer kubeadm |
you are correct and that's a regression. PR fixes are welcome, we also need to backport the fix to 1.29. i think this is a fix: isDefaultKubeConfigPath := d.KubeConfigPath() == kubeadmconstants.GetAdminKubeConfigPath()
// Only bootstrap the admin.conf if it's used by the user (i.e. --kubeconfig has its default value)
// and if the bootstrapping was not already done
if !d.adminKubeConfigBootstrapped && isDefaultKubeConfigPath {
// Call EnsureAdminClusterRoleBinding() to obtain a working client from admin.conf.
d.client, err = kubeconfigphase.EnsureAdminClusterRoleBinding(kubeadmconstants.KubernetesDir, nil)
if err != nil {
return nil, errors.Wrapf(err, "could not bootstrap the admin user in file %s", kubeadmconstants.AdminKubeConfigFileName)
}
d.adminKubeConfigBootstrapped = true
} else {
// Alternatively, just load the config pointed at the --kubeconfig path
d.client, err = kubeconfigutil.ClientSetFromFile(d.KubeConfigPath())
if err != nil {
return nil, err
}
} other ideas are welcome too. |
Thanks for the quick feedback @neolit123. I'd be happy to open a PR. |
/assign avorima |
Don't create admin rolebindings when --kubeconfig is set to a non-default value. Fixes: kubernetes/kubeadm#2992 Signed-off-by: Mario Valderrama <[email protected]>
Don't create admin rolebindings when --kubeconfig is set to a non-default value. Fixes: kubernetes/kubeadm#2992 Signed-off-by: Mario Valderrama <[email protected]>
Don't create admin rolebindings when --kubeconfig is set to a non-default value. Fixes: kubernetes/kubeadm#2992 Signed-off-by: Mario Valderrama <[email protected]>
Don't create admin rolebindings when --kubeconfig is set to a non-default value. Fixes: kubernetes/kubeadm#2992 Signed-off-by: Mario Valderrama <[email protected]>
Don't create admin rolebindings when --kubeconfig is set to a non-default value. Fixes: kubernetes/kubeadm#2992 Signed-off-by: Mario Valderrama <[email protected]>
What happened?
Using
kubeadm init phase bootstrap-token
no longer works stand-alone in 1.29. The--kubeconfig
flag is ignored and it requires/etc/kubernetes/admin.conf
orsuper-admin.conf
to exist.The release notes did not mention this behavior change.
What did you expect to happen?
In 1.28 it used to be possible to create a bootstrap-token using:
kubeadm init phase bootstrap-token --kubeconfig someconfig.yaml
.For example using kubeadm 1.28.5 from https://dl.k8s.io/v1.28.5/kubernetes-node-linux-amd64.tar.gz:
How can we reproduce it (as minimally and precisely as possible)?
Set up a kind cluster to get a working kubeconfig file:
Run this command with kubeadm 1.28.5 and 1.29.0:
Anything else we need to know?
To me it looks like the problem is that the codepath where --kubeconfig is used is unreachable. https://github.com/kubernetes/kubernetes/blob/v1.29.0/cmd/kubeadm/app/cmd/init.go#L529
The only place where
adminKubeConfigBootstrapped
is set is in the if block above, so the else is never taken.This change was introduced in kubernetes/kubernetes#121305.
Kubernetes version
1.29.0
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: