kubernetes卷为node_modules
在docker-compose中,我用这种方式创build了卷:
volumes: - ./server:/home/app - /home/app/node_modules
为了解决node_modules
的问题。
我怎么能在kubernetes中解决这个问题?
我创build了以下configuration
spec: containers: - env: [] image: "image" volumeMounts: - mountPath: /home/app name: vol-app - mountPath: /home/app/node_modules name: vol-node-modules name: demo volumes: - name: vol-app hostPath: path: /Users/me/server - name: vol-node-modules emptyDir: {}
但它不起作用。 node_modules是空的
node_modules是空的
这是空的,因为你正在使用emptyDir
卷 :
当Pod被分配给节点时,首先创build
emptyDir
卷,并且只要该Pod在该节点上运行,就会存在。 正如名字所说,它最初是空的。
应用程序应该写入数据。