how to mount container root directories /mnt , /dev, /opt in kubernetes podspec

Viewed 34

I want to mount the container root system directories like /mnt, //dev and /opt with kubernetes podspec volumes. Not able to do it.

working docker command used is

docker run -d --network host --name test_container --volume test_volume:/mnt --privileged -v /dev:/dev $IMAGE_NAME

in podspec, i mentioned for container as below: volumeMounts: - mountPath: /mnt name: mnt-data - mountPath: /dev name: dev-data

volumes:

  • name: dev-data hostPath: path: /dev type: Directory
  • name: mnt-data

This is not working when i am doing kubectl apply -f podspec.yaml Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: "/mnt/script.sh": stat /mnt/script.sh: no such file or directory": unknown

through docker run command its working fine but failing through kubernetes podspec

0 Answers
Related