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

[teleport] kops fails due to inconsistent cluster names #474

Open
Nuru opened this issue May 10, 2019 · 0 comments
Open

[teleport] kops fails due to inconsistent cluster names #474

Nuru opened this issue May 10, 2019 · 0 comments

Comments

@Nuru
Copy link
Sponsor Contributor

Nuru commented May 10, 2019

what

When using Teleport tsh login to connect to a cluster, although kubectl works fine, kops does not, because, in general, the Teleport name of the cluster is not the same as the kops cluster name. This leads to an error like

 ⧉  staging (staging:default)+
 √ : (cpco-staging-admin) helmfiles ⨠ kops validate cluster
Validating cluster us-west-2.staging.cpco.io

Cannot load kubecfg settings for "us-west-2.staging.cpco.io": context "us-west-2.staging.cpco.io" does not exist

why

kops needs the name of the cluster in 2 places: its configuration in its state store and the context setting in KUBECONFIG. It has a --name flag to set the name, but it still expects it to be the same in both places. Typically, however, the Teleport name of the cluster is different due to Teleport requirements.

workaround

There is a workaround. After tsh login you can run:

kubectl config rename-context $(kubectl config current-context) $KOPS_CLUSTER_NAME

This enables kops to find the correct context and does not bother kubectl because technically the context name is independent of the cluster name.

leb4r pushed a commit that referenced this issue Jan 25, 2022
Co-authored-by: osterman <osterman@users.noreply.github.com>
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

1 participant