2929 - node1
3030 - node2
3131 priorityClassName : dev-gpu
32- serviceAccountName : k8s-launcher
32+
33+ serviceAccountName : devenv-testuser
34+ automountServiceAccountToken : false
3335
3436 containers :
37+ - name : token-syncer
38+ image : busybox:latest
39+ command :
40+ - /bin/sh
41+ - -c
42+ - |
43+ while true; do
44+ if [ -f /var/run/secrets/kubernetes.io/serviceaccount/token ]; then
45+ cp /var/run/secrets/kubernetes.io/serviceaccount/token /shared/token
46+ cp /var/run/secrets/kubernetes.io/serviceaccount/ca.crt /shared/ca.crt
47+ cp /var/run/secrets/kubernetes.io/serviceaccount/namespace /shared/namespace
48+ chmod 644 /shared/*
49+ fi
50+ sleep 60
51+ done
52+ securityContext :
53+ runAsUser : 0
54+ readOnlyRootFilesystem : true
55+ allowPrivilegeEscalation : false
56+ capabilities :
57+ drop : ["ALL"]
58+ resources :
59+ requests :
60+ cpu : " 10m"
61+ memory : " 16Mi"
62+ limits :
63+ cpu : " 50m"
64+ memory : " 32Mi"
65+ volumeMounts :
66+ - name : shared-token
67+ mountPath : /shared
68+ - name : sa-token-source # Mount the projected volume
69+ mountPath : /var/run/secrets/kubernetes.io/serviceaccount
70+ readOnly : true
71+
3572 - name : testuser
3673 image : ubuntu:22.04
3774 workingDir : " /src"
79116 memory : " 16Gi"
80117
81118 volumeMounts :
82- - name : devenv-manager-token
83- mountPath : /var/run/secrets/tokens
84- readOnly : true
85119 - name : dev-storage
86120 mountPath : /home/testuser
87121 - name : dev-linuxbrew
@@ -93,15 +127,12 @@ spec:
93127 mountPath : /data
94128 - name : config-volume
95129 mountPath : /config
130+ - name : shared-token # Add this mount
131+ mountPath : /var/run/secrets/devenv
132+ readOnly : true
133+
96134
97135 volumes :
98- - name : devenv-manager-token
99- projected :
100- sources :
101- - serviceAccountToken :
102- path : devenv-manager
103- expirationSeconds : 3600
104- audience : devenv-manager
105136 - name : dev-storage
106137 hostPath :
107138 path : /mnt/devenv/testuser/homedir
@@ -114,6 +145,16 @@ spec:
114145 configMap :
115146 name : startup-scripts-testuser
116147 defaultMode : 0755
148+ - name : shared-token # Add this volume
149+ emptyDir :
150+ sizeLimit : 1Mi
151+ - name : sa-token-source
152+ projected :
153+ sources :
154+ - serviceAccountToken :
155+ path : token
156+ expirationSeconds : 3600 # Token expires after 1 hour
157+ audience : devenv-manager # Your custom audience!
117158 - name : data-volume
118159 hostPath :
119160 path : /mnt/data
0 commit comments