Nitin Gupta:
i am facing issues where my maridb data is lost when restart count increase to 1
Akshay:
try this command to fetch the reason why pod was restarted.
kubectl get pod -o go-template='{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"\r\nLastState: "}}{{.lastState}}{{end}}'
OR
kubectl logs <pod> -f --previous
On a side note:
Pods are ephemeral, which makes running databases on k8s really tricky. The application design should have a good circuit-breaker pattern to be resilient to few seconds of DB unavailability.
If not, it’s better to run DB on more predictable VMs than k8s.
Nitin Gupta:
sure let me check it thanks