I have a openshift deployment which is using NFS to save the logs and it is mapped to PV and PVC added to the container as below.
volumeMounts:
- name: outputlog
mountPath: /logs
And it is mapped to the PVC mount as below.
volumes:
- name: outputlog
persistentVolumeClaim:
claimName: "pvc-1"
So the problem is when doing the chaos testing if the network latency is more than 2 seconds the NFS is not responding and the pods are keep restarting which caused 502 error continuously.
As a solution i feel it is better to mount to emptydir and logs temporary saved in pod's directory.
So the questions are
- will that be feasible
- If it is feasible what could be the mechanism to do it?
Cheers.
No, I don't think this is feasible. In theory, sure, you could use an
emptyDir
mount for logging. But, as you point out, you are going to lose all of your logs when a pod is stopped (even from something like autoscaling). emptyDir is designed to be ephemeral, so if your data isn't ephemeral, don't use emptyDir. Also, it's just going to make it very difficult to access your logs.Without more information it's hard to really say what you should do. It depends on how much you can change your app, how much latitude you have fix your NFS problems, how delayed your logs can be, and what tools you already have for log management. But in general: