@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.