-
Notifications
You must be signed in to change notification settings - Fork 13
/
daemonset.yaml
47 lines (46 loc) · 1.22 KB
/
daemonset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: root-ssh-manager
namespace: kube-system
spec:
selector:
matchLabels:
app: root-ssh-manager
template:
metadata:
labels:
app: root-ssh-manager
spec:
containers:
- name: update-ssh-authorized-keys
image: busybox:latest
securityContext:
privileged: true
command:
- "/bin/sh"
- "-c"
- |
set -o errexit
set -o xtrace
umask 0077
while true
do
mkdir -p /mnt/root/.ssh
rm -f /mnt/root/.ssh/authorized_keys_new
for key in $(find /mnt/keys -type f); do (cat ${key}; echo) >> /mnt/root/.ssh/authorized_keys_new; done
mv /mnt/root/.ssh/authorized_keys_new /mnt/root/.ssh/authorized_keys
sleep 60s;
done
volumeMounts:
- name: root
mountPath: /mnt/root
- name: ssh-keys
mountPath: /mnt/keys
volumes:
- name: root
hostPath:
path: /root
- name: ssh-keys
configMap:
name: root-ssh-pubkeys