-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
kind create cluster creates same kubeconfig user name for each cluster #112
Comments
/assign |
this seems to be kubernetes/kubeadm#416, looking into options... |
I asked in #sig-cluster-lifecycle, so far I don't think there's an answer for this. Following up... |
@neolit123 @fabriziopandini WDYT? |
I've hit this problem previously while using multiple k8s clusters. Turns out one can use the same username in all your clusters. What needs to be tweaked in the kubeconfig file is changing the I'll try my hand at writing a PR for it. |
Ah, I see that it is kubeadm that generates the kubeconfig file and may not allow what kind needs for this. I'll have a look at kubeadm some more. But modifying the kubeconfig file after it is generated would be an option. |
Ok, I've got things working. Here is what the new kubeconfig file looks like for a cluster named
I just need to get official approval from my employer to do the PR. Should be a couple of days. |
kubeadm does not currently allow to configure a user reference id, and instead always uses kubernetes-admin. This causes a problem when we create multiple clusters with Kind and want to use each corresponding kubeconfig file at the same time in KUBECONFIG. Until kubeadm supports configuring a user reference id, the only option to fix this for Kind is to modify the kubeconfig file that kubeadm provides. As Kind already did this with the server name, it made sense to take the logic further and also make the user reference id unique to a cluster. Three approaches were considered: 1- continue with the current approach of parsing each line of the admin.conf kubeconfig file, and make the modifications necessary. After implementing this approach, the solution seemed quite brittle as it uses regex but no yaml structure. 2- use the go package yaml.v2 to -fully- parse the yaml of the admin.conf kubeconfig file, make the modifications, and then output the new yaml kubeconfig file. This solution requires to define a detailed struct of every field contained in the original yaml file. Having to map every field in advance is brittle as any modification that kubeadm may make to the file in the future would require adaptation in Kind. 3- use the go package yaml.v2 to -generically- parse the yaml of the admin.conf kubeconfig file, make the modifications, and then output the new yaml kubeconfig file. This solution only accesses the yaml fields that are required to be modified. Although any future changes from kubeadm to those fields would require modifications in Kind, modifications to all other fields would not. This commit implements solution #3 which was felt to be the most future-proof and least brittle of the three. Signed-off-by: Marc Khouzam <[email protected]>
It seems that when I add eg:
But when I add eg:
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
see: #850, proposing to solve this along with other changes |
fixing in #850. kind clusters will have unique entries. have this part implemented pretty cleanly. |
/lifecycle active |
/close |
@aojea: Closing this issue. In response to this:
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. |
…licy [EOS-11379] Soportar Kubernetes v1.25
When creating multiple clusters with
kind create cluster --name <name>
the kubeconfig for each cluster specifies the same user name ofkubernetes-admin
. This becomes a problem when trying to use multiple kubeconfigs inKUBECONFIG
because the user name overlaps with each of the configs. For example:Instead each auth user name should include the
--name
of the kind cluster when specified in thekind create cluster --name <name>
command.The text was updated successfully, but these errors were encountered: