Closed ssz1997 closed 1 year ago
I tried two things, both of them don't have to use sidecar.
kubectl logs <pod>
. But this is not enough because this log will rotate after 10M, which is fairly small and may already lost when people find out. Unless they have another logging agentkubectl get po
. This is different from the first case because OOM is triggered from k8s, not jvm. In this case it's easy to spot the problem and no need of logs at all.Therefore we should use hostPath, but no need of sidecar.
@Kai-Zhang I made the hostPath configurable in case hostPath is not available cuz I don't know whether it is available. PTAL. Thanks!
The k8s pod will restart after OOM. We now have persistent log for people to do investigation.
kubectl get logs --previous
can't get the old log.In this doc https://kubernetes.io/docs/concepts/cluster-administration/logging/, sidecar is a common way to keep the logs. We use hostPath here and the reason we add a sidecar is because not all users have the permission to log onto the host machine.