kubernetes / kops

Kubernetes Operations (kOps) - Production Grade k8s Installation, Upgrades and Management
https://kops.sigs.k8s.io/
Apache License 2.0
15.66k stars 4.61k forks source link

Wrong SSH username on GCE #16642

Open DerrickMartinez opened 2 days ago

DerrickMartinez commented 2 days ago

/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.