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

Wrong SSH username on GCE #16642

Open
DerrickMartinez opened this issue Jun 28, 2024 · 2 comments · May be fixed by #16663
Open

Wrong SSH username on GCE #16642

DerrickMartinez opened this issue Jun 28, 2024 · 2 comments · May be fixed by #16663
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@DerrickMartinez
Copy link
Contributor

DerrickMartinez commented Jun 28, 2024

/kind bug

1. What kops version are you running? The command kops version, will display
this information.

v1.29.0

2. What Kubernetes version are you running? kubectl version will print the
version if a cluster is running or provide the Kubernetes version specified as
a kops flag.

1.29.5

3. What cloud provider are you using?

GCP

4. What commands did you run? What is the simplest way to reproduce this issue?

After an instance is in service you cannot SSH. The SSH username is set to admin, not ubuntu.

- key: ssh-keys
  value: 'admin: ssh-rsa AAAAB3NzaC1yc2blah... ubuntu@localhost'

Here is a valid, working instance template that it should look like

- key: ssh-keys
  value: ubuntu:ssh-rsa AAAAB3NzaC1yc2blah... ubuntu@localhost

It looks like fi.SecretNameSSHPrimary is a const of admin

pkg/model/gcemodel/autoscalinggroup.go: gFmtKeys = append(gFmtKeys, fmt.Sprintf("%s: %s", fi.SecretNameSSHPrimary, key))

I would be willing to submit a PR depending on how we want to fix this.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 28, 2024
@DerrickMartinez DerrickMartinez linked a pull request Jul 8, 2024 that will close this issue
@hakman
Copy link
Member

hakman commented Jul 9, 2024

@DerrickMartinez what image are you using for your instances and what is the cluster creation command?

@VitusAcabado
Copy link

VitusAcabado commented Sep 23, 2024

Hi I am experiencing the same issue. Image I am using for my instance groups is: ubuntu-os-cloud/ubuntu-2204-jammy-v20240904

If I add a global public key to GCP metadata it works, however since kops instance group sets the username as admin, key will not work if I disable the global public key.

this works as gcp infers that the username should be ubuntu:
image

public key added by kops does not as username set is admin:
image

I am using kops client version 1.30.0 and kubernetes version of 1.27.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants