How to retain logs after pod deletion?

Ritika Laddha 65 Reputation points

Is there any way to add configuration to my AKS cluster to keep log data from Kubernetes pods that have been deleted. For example, If there were 3 pods running, after sometime or maybe a day; there are only 2 pods. I would want to see logs of that terminated/ deleted pod.

Is there a way to configure some logging solution in AKS to store the logs of deleted pods for a period of time? Or If pod is going to be terminated it should save logs somewhere before termination.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,647 questions
0 comments No comments
{count} votes

Accepted answer
  1. KarishmaTiwari-MSFT 16,482 Reputation points Microsoft Employee

    @Ritika Laddha Thanks for posting your query on Microsoft Q&A.

    You can use Azure Monitor to collect logs from your AKS cluster and store them in a Log Analytics workspace. Azure Monitor provides a centralized solution for collecting, analyzing, and acting on telemetry from your cloud and on-premises environments.

    To retain logs of deleted pods, you can configure log retention for the Log Analytics workspace. This will allow you to store logs for a specified period, even if the pods that generated the logs have been deleted.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful