This approach leverages the KubeadmControlPlane CRD spec and ytt overlays to add user and password. For additional modification refer to the linked spec. In this scenario, we have used the following parameters
openssl passwd -6 -salt xyz changeme
$6$xyz$9vc9yeDgngEirzYEeLZqCay8YLhc7JHmd1t2UYrjdm7dD0M6raCXz.xtEXBL4.aaRf26S/aKagS36D1iH7E79
Write the overlay yaml add_user.yaml at the path below
cat << EOF >> ~/.tkg/providers/infrastructure-vsphere/ytt/add_user.yaml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"kind":"KubeadmControlPlane"})
---
spec:
kubeadmConfigSpec:
users:
#@overlay/match by=overlay.index(1)
#@overlay/append
- name: oom
lockPassword: false
passwd: '\$6\$xyz\$9vc9yeDgngEirzYEeLZqCay8YLhc7JHmd1t2UYrjdm7dD0M6raCXz.xtEXBL4.aaRf26S/aKagS36D1iH7E79.'
sudo: ALL=(ALL) NOPASSWD:ALL
EOF
After the addition of this overlay any clusters that you create, its control plane will have a user oom with password changeme pre-configured.
Once the troubleshooting is completed please remove the overlay file
rm ~/.tkg/providers/infrastructure-vsphere/ytt/add_user.yaml