我一直试图使用以下内容来访问卷挂载中的文件:
with open('./log/file.json', 'w+') as f:
f.write(json.dumps(output, sort_keys=True, indent=4))但这是行不通的。有什么想法吗?在我的部署文件中,我有以下内容:
volumeMounts:
- mountPath: /logs
name: wag-log发布于 2019-10-21 17:59:38
您已经定义了一个volumeMount,将mountPath设置为/logs,这将将卷挂载到/logs目录。在您的Python代码中,您正在编写path ./log/file.json,它不是用/logs编写的。
尝试将日志写入您挂载的目录,例如:
with open('/logs/file.json', 'w+') as f:
f.write(json.dumps(output, sort_keys=True, indent=4))https://stackoverflow.com/questions/58491608
复制相似问题