How can I set the hostPath volume permission on kubernetes?

6/8/2018

It seems by default Kubernetes creates a hostPath volume with 755 permission on a directory.

Is it possible to set this value to something else by a volume spec? As opposed to manually doing a chmod on the relevent host directory.

-- Chris Stryczynski
kubernetes

1 Answer

6/8/2018
  initContainers:
    - name: volume-mount-hack
      image: busybox
      command: ["sh", "-c", "chmod -R 777 /tmp/docker"]
      volumeMounts:
      - name: redis-socket
        mountPath: /tmp/docker
-- Chris Stryczynski
Source: StackOverflow