Mount Hostpath volume as non root user

How can i mount a volume create from hostpath to a pod, so that the pod running as non-root user can perform read-write operations on that volume. I don’t want to user one more init container to do this thing, as it increases the container boot time.

I tried setting fsgroup and runasuser to uid of non root user, but it is not working for volumes created from hostpath.

Cluster information:

Kubernetes version:
Cloud being used: AWS EKS
Installation method: AWS Managed
Host OS: Amazon linux

I’m having the same issue, with hostPath to be specific. any idea how to fix this?

You can use local persistent volume. Which is similar to hostpath with some additional features you can then configure fsgroup to set user acces permission.

https://kubernetes.io/blog/2019/04/04/kubernetes-1.14-local-persistent-volumes-ga/