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

User setup #76

Open
luisdavim opened this issue Nov 22, 2023 · 2 comments
Open

User setup #76

luisdavim opened this issue Nov 22, 2023 · 2 comments

Comments

@luisdavim
Copy link
Contributor

luisdavim commented Nov 22, 2023

kubeadm suports this https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/blob/main/templates/cluster-template.yaml#L184

users:
    - name: capv
      sshAuthorizedKeys:
      - '${VSPHERE_SSH_AUTHORIZED_KEY}'
      sudo: ALL=(ALL) NOPASSWD:ALL

it would be nice to have something similar in the KThreesControlPlane

see: https://github.com/kubernetes-sigs/cluster-api/blob/b587ff982f33a7d22d32991ebbeb9ea20e3be888/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go#L533

@mquhuy
Copy link

mquhuy commented Jan 4, 2024

Hi. I bumped into the same issue as you, so posting here a workaround.

In either preK3sCommands: or postK3sCommands: block, put something like this

- useradd -m metal3
- echo 'metal3:password' | chpasswd
- usermod -aG sudo metal3
- echo 'metal3 ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo
- mkdir -p /home/metal3/.ssh
- chown metal3:metal3 /home/metal3/.ssh
- chmod 700 /home/metal3/.ssh
- echo '${SSH_AUTHORIZED_KEY}' > /home/metal3/.ssh/authorized_keys
- chown metal3:metal3 /home/metal3/.ssh/authorized_keys
- chmod 600 /home/metal3/.ssh/authorized_keys

I hope it helps!

@luisdavim
Copy link
Contributor Author

Yeah, that's what I used as well but it would be nice to have a more native way of doing it like the kubeadm provider supports.

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

2 participants