adamant-france-62364
12/29/2022, 12:24 PM/Users/$USER/.aws
in my containers, given that /Users/$USER
is mounted in the host node by default.
Is there a way to express this in the Pod's volume and container's volumeMount generically?
The problem being that the value of $USER is not known in the cluster.
A few ideas:
• Use mountPoint in overlay.yaml to elide the $USER
mounts:
- location: "~/.aws"
mountPoint: /user-aws
• Use subPathExpr in volumeMount in combination with $USER env var
volumeMounts:
- name: users # /Users
subPathExpr: $(USER)/.aws
• Use helm or kpt to substitute
Other ideas?bitter-hairdresser-7812
12/29/2022, 10:17 PMadamant-france-62364
12/29/2022, 10:24 PMsubPathExpr
approach does work, and that's what we're going with now.
I haven't tried changing/adding a mountPoint
in overlay.yaml
. For one thing, mountPoint is barely documented, but I can see it in the source code.spec:
containers:
- name: example
envFrom:
- configMapRef:
name: user # USER=
volumeMounts:
- name: users
mountPath: /some/path
subPathExpr: $(USER)
readOnly: true
volumes:
- name: users
hostPath:
path: /Users
type: Directory