Skip to content

Commit 5de3c64

Browse files
Create etcd user in cloud-init master.yaml rather than in configure-helper.sh
An etcd unix user is currently created in configure-helper.sh if it does not exist on the master. cloud-init is the only supported mechanism to add users on COS VMs. If an attempt is made to add a key using OS Login or the instance metadata mechanism the google_accounts_daemon will race with useradd and potentially attempt to use the same UID. This will lock out any attempt to SSH into the VM. We therefore migrate to using cloud-init to create this user and prevent this issue from occurring.
1 parent 21d4d13 commit 5de3c64

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cluster/gce/gci/configure-helper.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ function mount-master-pd {
445445
mkdir -p "${mount_point}/srv/sshproxy"
446446
ln -s -f "${mount_point}/srv/sshproxy" /etc/srv/sshproxy
447447

448-
if ! id etcd &>/dev/null; then
449-
useradd -s /sbin/nologin -d /var/etcd etcd
450-
fi
451448
chown -R etcd "${mount_point}/var/etcd"
452449
chgrp -R etcd "${mount_point}/var/etcd"
453450
}

cluster/gce/gci/master.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#cloud-config
22

3+
users:
4+
- name: etcd
5+
homedir: /var/etcd
6+
lock_passwd: true
7+
38
write_files:
49
- path: /etc/systemd/system/kube-master-installation.service
510
permissions: 0644

0 commit comments

Comments
 (0)