Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Use the cluster name in cluster.yaml in admin.conf #636

Closed
karan opened this issue Mar 6, 2018 · 10 comments
Closed

Use the cluster name in cluster.yaml in admin.conf #636

karan opened this issue Mar 6, 2018 · 10 comments

Comments

@karan
Copy link
Contributor

karan commented Mar 6, 2018

Currently the cluster config is created with cluster name as kubernetes. There is a cluster name in the cluster.yaml metadata.name. We should start using that name for the cluster so tools can be made to target any cluster in kubeconfig file.

@karan
Copy link
Contributor Author

karan commented Mar 6, 2018

cc @jessicaochen @rsdcastro - If no objections, I can start to look into this.

@rsdcastro
Copy link

It does make sense to me.

@karan
Copy link
Contributor Author

karan commented Mar 6, 2018

Seems like the cluster name is hardcoded in kubeadm:

https://github.com/kubernetes/kubernetes/blob/999c2ae8716b76099b30da4cea973d0e2c737f77/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go#L191

There's been a PR to make it configurable, but it's been stale: kubernetes/kubernetes#52470

@rsdcastro
Copy link

Perhaps we can work on a new PR that focus on the cluster name to avoid the contention on the other point (user admins)?

@jessicaochen
Copy link
Contributor

I may be wrong but I think it is just the name in the kubeconfig file to reference the cluster. If you change the name in the kubeconfig file or set a new one with the name your want (https://kubernetes-v1-4.github.io/docs/user-guide/kubectl/kubectl_config_set-cluster/), you can still address the same cluster.

In that way, it really does not matter what kubeadm happens to dump as the cluster name on the master.

@karan
Copy link
Contributor Author

karan commented Mar 6, 2018

You are right @jessicaochen. I tried this with s/kubernetes/testcluster on my local kubeconfig file. I don't think we should be doing this in the final product, it's just hacky, and error prone. Instead the cluster name really just should be an option that kubeadm uses to save the original file.

@jessicaochen
Copy link
Contributor

I guess it depends on how important urgent this change is. Whether we want to wait for kubeadm to do it or we want an interim solution.

@karan
Copy link
Contributor Author

karan commented Mar 6, 2018

/label cluster-api

@karan
Copy link
Contributor Author

karan commented Mar 7, 2018

As a prototype we could live with managing a single cluster (or doing something hacky), but at least for an alpha/MVP, a good approach is to support cluster names.

I've already sent them a PR for it.

@rsdcastro
Copy link

This issue was moved to kubernetes-sigs/cluster-api#49

k8s-github-robot pushed a commit to kubernetes/kubernetes that referenced this issue Apr 12, 2018
Automatic merge from submit-queue (batch tested with PRs 58178, 62491, 60852). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[kubeadm] Add support for clusterName in config file.

**What this PR does / why we need it**: Adds a `--cluster-name` arg to kubeadm init.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
See kubernetes-retired/kube-deploy#636
Code inspired by #52470

**Special notes for your reviewer**:

**Release note**:

```release-note
Adds --cluster-name to kubeadm init for specifying the cluster name in kubeconfig.
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants