adamant-france-6236412/29/2022, 12:24 PM
in my containers, given that
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
• Use subPathExpr in volumeMount in combination with $USER env var
mounts: - location: "~/.aws" mountPoint: /user-aws
• Use helm or kpt to substitute Other ideas?
volumeMounts: - name: users # /Users subPathExpr: $(USER)/.aws
bitter-hairdresser-781212/29/2022, 10:17 PM
adamant-france-6236412/29/2022, 10:24 PM
approach does work, and that's what we're going with now. I haven't tried changing/adding a
. 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