Considering a K8s
cluster has 3 pods
, each has a docker container of same
SpringBoot
app providing web services, with LogBack
as logging solution.
Log path for each Spring Boot app is the same, and each application will do the same file logging, defined in application.properties
. I wonder if without any volume
configuration, is it going to cause locking situation
so that each Spring Boot app will try to write to the same file at same time?
If above speculation is true, what is the best practice? Below is what I can think of
Create different
volume
for each pod so logging file write to different physical location. I think it is an overkill for loggingGenerate unique file name
suffix
so app log file name for each application is different. Simply can be just cut off of pod name. However this solution requires to pass dynamic parameters to the pod -> container -> application